Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: net/quic/quic_crypto_client_stream.cc

Issue 189963002: QUIC - histograms to measure the time spent to read QUIC sever (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/quic_server_info.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_crypto_client_stream.h" 5 #include "net/quic/quic_crypto_client_stream.h"
6 6
7 #include "base/metrics/histogram.h"
8 #include "base/time/time.h"
7 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
8 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
9 #include "net/quic/crypto/crypto_protocol.h" 11 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/crypto_utils.h" 12 #include "net/quic/crypto/crypto_utils.h"
11 #include "net/quic/crypto/null_encrypter.h" 13 #include "net/quic/crypto/null_encrypter.h"
12 #include "net/quic/crypto/proof_verifier.h" 14 #include "net/quic/crypto/proof_verifier.h"
13 #include "net/quic/crypto/proof_verifier_chromium.h" 15 #include "net/quic/crypto/proof_verifier_chromium.h"
14 #include "net/quic/crypto/quic_server_info.h" 16 #include "net/quic/crypto/quic_server_info.h"
15 #include "net/quic/quic_protocol.h" 17 #include "net/quic/quic_protocol.h"
16 #include "net/quic/quic_session.h" 18 #include "net/quic/quic_session.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 417 }
416 418
417 int QuicCryptoClientStream::DoLoadQuicServerInfo( 419 int QuicCryptoClientStream::DoLoadQuicServerInfo(
418 QuicCryptoClientConfig::CachedState* cached) { 420 QuicCryptoClientConfig::CachedState* cached) {
419 next_state_ = STATE_SEND_CHLO; 421 next_state_ = STATE_SEND_CHLO;
420 QuicServerInfo* quic_server_info = cached->quic_server_info(); 422 QuicServerInfo* quic_server_info = cached->quic_server_info();
421 if (!quic_server_info) { 423 if (!quic_server_info) {
422 return OK; 424 return OK;
423 } 425 }
424 426
427 quic_server_info->set_read_start_time(base::TimeTicks::Now());
Ryan Hamilton 2014/03/07 04:41:04 I would have expected that this start time would b
ramant (doing other things) 2014/03/07 06:09:28 We share the same quic_server_info (server config)
ramant (doing other things) 2014/03/07 16:23:57 We go to disk only once for each hostname. After t
ramant (doing other things) 2014/03/07 21:57:15 Changed the code to collect stats when we load ser
425 generation_counter_ = cached->generation_counter(); 428 generation_counter_ = cached->generation_counter();
426 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE; 429 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE;
427 430
428 // TODO(rtenneti): If multiple tabs load the same URL, all requests except for 431 // TODO(rtenneti): If multiple tabs load the same URL, all requests except for
Ryan Hamilton 2014/03/07 04:41:04 I think this TODO is not correct. We will only ha
ramant (doing other things) 2014/03/07 06:09:28 I think comment shouldn't have said same URL. I me
ramant (doing other things) 2014/03/07 16:23:57 Done.
429 // the first request send InchoateClientHello. Fix the code to handle multiple 432 // the first request send InchoateClientHello. Fix the code to handle multiple
430 // requests. A possible solution is to wait for the first request to finish 433 // requests. A possible solution is to wait for the first request to finish
431 // and use the data from the disk cache for all requests. 434 // and use the data from the disk cache for all requests.
432 // We may need to call quic_server_info->Persist later. 435 // We may need to call quic_server_info->Persist later.
433 // quic_server_info->Persist requires quic_server_info to be ready, so we 436 // quic_server_info->Persist requires quic_server_info to be ready, so we
434 // always call WaitForDataReady, even though we might have initialized 437 // always call WaitForDataReady, even though we might have initialized
435 // |cached| config from the cached state for a canonical hostname. 438 // |cached| config from the cached state for a canonical hostname.
436 int rv = quic_server_info->WaitForDataReady( 439 int rv = quic_server_info->WaitForDataReady(
437 base::Bind(&QuicCryptoClientStream::OnIOComplete, 440 base::Bind(&QuicCryptoClientStream::OnIOComplete,
438 weak_factory_.GetWeakPtr())); 441 weak_factory_.GetWeakPtr()));
439 442
440 if (rv != ERR_IO_PENDING) { 443 if (rv != ERR_IO_PENDING) {
441 disk_cache_load_result_ = rv; 444 disk_cache_load_result_ = rv;
442 } 445 }
443 return rv; 446 return rv;
444 } 447 }
445 448
446 void QuicCryptoClientStream::DoLoadQuicServerInfoComplete( 449 void QuicCryptoClientStream::DoLoadQuicServerInfoComplete(
447 QuicCryptoClientConfig::CachedState* cached) { 450 QuicCryptoClientConfig::CachedState* cached) {
448 LoadQuicServerInfo(cached); 451 LoadQuicServerInfo(cached);
449 QuicServerInfo::State* state = cached->quic_server_info()->mutable_state(); 452 QuicServerInfo::State* state = cached->quic_server_info()->mutable_state();
450 state->Clear(); 453 state->Clear();
451 } 454 }
452 455
453 void QuicCryptoClientStream::LoadQuicServerInfo( 456 void QuicCryptoClientStream::LoadQuicServerInfo(
454 QuicCryptoClientConfig::CachedState* cached) { 457 QuicCryptoClientConfig::CachedState* cached) {
455 next_state_ = STATE_SEND_CHLO; 458 next_state_ = STATE_SEND_CHLO;
456 459
460 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheReadTime",
461 base::TimeTicks::Now() - cached->quic_server_info()->read_start_time());
462
457 // If someone else already saved a server config, we don't want to overwrite 463 // If someone else already saved a server config, we don't want to overwrite
458 // it. Also, if someone else saved a server config and then cleared it (so 464 // it. Also, if someone else saved a server config and then cleared it (so
459 // cached->IsEmpty() is true), we still want to load from QuicServerInfo. 465 // cached->IsEmpty() is true), we still want to load from QuicServerInfo.
460 if (!cached->IsEmpty()) { 466 if (!cached->IsEmpty()) {
461 return; 467 return;
462 } 468 }
463 469
464 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo( 470 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo(
465 session()->connection()->clock()->WallNow())) { 471 session()->connection()->clock()->WallNow())) {
466 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo 472 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo
467 // from the disk cache. 473 // from the disk cache.
468 DCHECK(cached->IsEmpty()); 474 DCHECK(cached->IsEmpty());
469 DVLOG(1) << "Empty server_config"; 475 DVLOG(1) << "Empty server_config";
470 return; 476 return;
471 } 477 }
472 478
473 ProofVerifier* verifier = crypto_config_->proof_verifier(); 479 ProofVerifier* verifier = crypto_config_->proof_verifier();
474 if (!verifier) { 480 if (!verifier) {
475 // If no verifier is set then we don't check the certificates. 481 // If no verifier is set then we don't check the certificates.
476 cached->SetProofValid(); 482 cached->SetProofValid();
477 } else if (!cached->signature().empty()) { 483 } else if (!cached->signature().empty()) {
478 next_state_ = STATE_VERIFY_PROOF; 484 next_state_ = STATE_VERIFY_PROOF;
479 } 485 }
480 } 486 }
481 487
482 } // namespace net 488 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_server_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698