OLD | NEW |
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/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // QUIC supports only secure urls. | 368 // QUIC supports only secure urls. |
369 if (GetSSLInfo(&ssl_info) && ssl_info.cert.get()) { | 369 if (GetSSLInfo(&ssl_info) && ssl_info.cert.get()) { |
370 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.ConnectRandomPortForHTTPS", | 370 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.ConnectRandomPortForHTTPS", |
371 round_trip_handshakes, 1, 3, 4); | 371 round_trip_handshakes, 1, 3, 4); |
372 if (require_confirmation_) { | 372 if (require_confirmation_) { |
373 UMA_HISTOGRAM_CUSTOM_COUNTS( | 373 UMA_HISTOGRAM_CUSTOM_COUNTS( |
374 "Net.QuicSession.ConnectRandomPortRequiringConfirmationForHTTPS", | 374 "Net.QuicSession.ConnectRandomPortRequiringConfirmationForHTTPS", |
375 round_trip_handshakes, 1, 3, 4); | 375 round_trip_handshakes, 1, 3, 4); |
376 } | 376 } |
377 } | 377 } |
| 378 |
378 const QuicConnectionStats stats = connection()->GetStats(); | 379 const QuicConnectionStats stats = connection()->GetStats(); |
379 if (server_info_ && stats.min_rtt_us > 0) { | |
380 base::TimeTicks wait_for_data_start_time = | |
381 server_info_->wait_for_data_start_time(); | |
382 base::TimeTicks wait_for_data_end_time = | |
383 server_info_->wait_for_data_end_time(); | |
384 if (!wait_for_data_start_time.is_null() && | |
385 !wait_for_data_end_time.is_null()) { | |
386 base::TimeDelta wait_time = | |
387 wait_for_data_end_time - wait_for_data_start_time; | |
388 const base::HistogramBase::Sample kMaxWaitToRtt = 1000; | |
389 base::HistogramBase::Sample wait_to_rtt = | |
390 static_cast<base::HistogramBase::Sample>( | |
391 100 * wait_time.InMicroseconds() / stats.min_rtt_us); | |
392 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicServerInfo.WaitForDataReadyToRtt", | |
393 wait_to_rtt, 1, kMaxWaitToRtt, 50); | |
394 } | |
395 } | |
396 | 380 |
397 // The MTU used by QUIC is limited to a fairly small set of predefined values | 381 // The MTU used by QUIC is limited to a fairly small set of predefined values |
398 // (initial values and MTU discovery values), but does not fare well when | 382 // (initial values and MTU discovery values), but does not fare well when |
399 // bucketed. Because of that, a sparse histogram is used here. | 383 // bucketed. Because of that, a sparse histogram is used here. |
400 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ClientSideMtu", | 384 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ClientSideMtu", |
401 connection()->max_packet_length()); | 385 connection()->max_packet_length()); |
402 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ServerSideMtu", | 386 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ServerSideMtu", |
403 stats.max_received_packet_size); | 387 stats.max_received_packet_size); |
404 | 388 |
405 UMA_HISTOGRAM_COUNTS("Net.QuicSession.MtuProbesSent", | 389 UMA_HISTOGRAM_COUNTS("Net.QuicSession.MtuProbesSent", |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 base::ResetAndReturn(&callback_).Run(OK); | 839 base::ResetAndReturn(&callback_).Run(OK); |
856 } | 840 } |
857 if (event == HANDSHAKE_CONFIRMED) { | 841 if (event == HANDSHAKE_CONFIRMED) { |
858 // Update |connect_end| only when handshake is confirmed. This should also | 842 // Update |connect_end| only when handshake is confirmed. This should also |
859 // take care of any failed 0-RTT request. | 843 // take care of any failed 0-RTT request. |
860 connect_timing_.connect_end = base::TimeTicks::Now(); | 844 connect_timing_.connect_end = base::TimeTicks::Now(); |
861 DCHECK_LE(connect_timing_.connect_start, connect_timing_.connect_end); | 845 DCHECK_LE(connect_timing_.connect_start, connect_timing_.connect_end); |
862 UMA_HISTOGRAM_TIMES( | 846 UMA_HISTOGRAM_TIMES( |
863 "Net.QuicSession.HandshakeConfirmedTime", | 847 "Net.QuicSession.HandshakeConfirmedTime", |
864 connect_timing_.connect_end - connect_timing_.connect_start); | 848 connect_timing_.connect_end - connect_timing_.connect_start); |
865 | |
866 if (server_info_) { | |
867 // TODO(rtenneti): Should we delete this histogram? | |
868 // Track how long it has taken to finish handshake once we start waiting | |
869 // for reading of QUIC server information from disk cache. We could use | |
870 // this data to compare total time taken if we were to cancel the disk | |
871 // cache read vs waiting for the read to complete. | |
872 base::TimeTicks wait_for_data_start_time = | |
873 server_info_->wait_for_data_start_time(); | |
874 if (!wait_for_data_start_time.is_null()) { | |
875 UMA_HISTOGRAM_TIMES( | |
876 "Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime", | |
877 base::TimeTicks::Now() - wait_for_data_start_time); | |
878 } | |
879 } | |
880 // Track how long it has taken to finish handshake after we have finished | 849 // Track how long it has taken to finish handshake after we have finished |
881 // DNS host resolution. | 850 // DNS host resolution. |
882 if (!connect_timing_.dns_end.is_null()) { | 851 if (!connect_timing_.dns_end.is_null()) { |
883 UMA_HISTOGRAM_TIMES( | 852 UMA_HISTOGRAM_TIMES( |
884 "Net.QuicSession.HostResolution.HandshakeConfirmedTime", | 853 "Net.QuicSession.HostResolution.HandshakeConfirmedTime", |
885 base::TimeTicks::Now() - connect_timing_.dns_end); | 854 base::TimeTicks::Now() - connect_timing_.dns_end); |
886 } | 855 } |
887 | 856 |
888 ObserverSet::iterator it = observers_.begin(); | 857 ObserverSet::iterator it = observers_.begin(); |
889 while (it != observers_.end()) { | 858 while (it != observers_.end()) { |
890 Observer* observer = *it; | 859 Observer* observer = *it; |
891 ++it; | 860 ++it; |
892 observer->OnCryptoHandshakeConfirmed(); | 861 observer->OnCryptoHandshakeConfirmed(); |
893 } | 862 } |
894 if (server_info_) | |
895 server_info_->OnExternalCacheHit(); | |
896 } | 863 } |
897 QuicSpdySession::OnCryptoHandshakeEvent(event); | 864 QuicSpdySession::OnCryptoHandshakeEvent(event); |
898 } | 865 } |
899 | 866 |
900 void QuicChromiumClientSession::OnCryptoHandshakeMessageSent( | 867 void QuicChromiumClientSession::OnCryptoHandshakeMessageSent( |
901 const CryptoHandshakeMessage& message) { | 868 const CryptoHandshakeMessage& message) { |
902 logger_->OnCryptoHandshakeMessageSent(message); | 869 logger_->OnCryptoHandshakeMessageSent(message); |
903 } | 870 } |
904 | 871 |
905 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( | 872 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 } | 1488 } |
1522 | 1489 |
1523 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { | 1490 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { |
1524 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's | 1491 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's |
1525 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and | 1492 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and |
1526 // unacked packet map. | 1493 // unacked packet map. |
1527 return base::trace_event::EstimateMemoryUsage(packet_readers_); | 1494 return base::trace_event::EstimateMemoryUsage(packet_readers_); |
1528 } | 1495 } |
1529 | 1496 |
1530 } // namespace net | 1497 } // namespace net |
OLD | NEW |