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 | |
379 const QuicConnectionStats stats = connection()->GetStats(); | 378 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 } |
380 | 396 |
381 // The MTU used by QUIC is limited to a fairly small set of predefined values | 397 // The MTU used by QUIC is limited to a fairly small set of predefined values |
382 // (initial values and MTU discovery values), but does not fare well when | 398 // (initial values and MTU discovery values), but does not fare well when |
383 // bucketed. Because of that, a sparse histogram is used here. | 399 // bucketed. Because of that, a sparse histogram is used here. |
384 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ClientSideMtu", | 400 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ClientSideMtu", |
385 connection()->max_packet_length()); | 401 connection()->max_packet_length()); |
386 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ServerSideMtu", | 402 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ServerSideMtu", |
387 stats.max_received_packet_size); | 403 stats.max_received_packet_size); |
388 | 404 |
389 UMA_HISTOGRAM_COUNTS("Net.QuicSession.MtuProbesSent", | 405 UMA_HISTOGRAM_COUNTS("Net.QuicSession.MtuProbesSent", |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 base::ResetAndReturn(&callback_).Run(OK); | 850 base::ResetAndReturn(&callback_).Run(OK); |
835 } | 851 } |
836 if (event == HANDSHAKE_CONFIRMED) { | 852 if (event == HANDSHAKE_CONFIRMED) { |
837 // Update |connect_end| only when handshake is confirmed. This should also | 853 // Update |connect_end| only when handshake is confirmed. This should also |
838 // take care of any failed 0-RTT request. | 854 // take care of any failed 0-RTT request. |
839 connect_timing_.connect_end = base::TimeTicks::Now(); | 855 connect_timing_.connect_end = base::TimeTicks::Now(); |
840 DCHECK_LE(connect_timing_.connect_start, connect_timing_.connect_end); | 856 DCHECK_LE(connect_timing_.connect_start, connect_timing_.connect_end); |
841 UMA_HISTOGRAM_TIMES( | 857 UMA_HISTOGRAM_TIMES( |
842 "Net.QuicSession.HandshakeConfirmedTime", | 858 "Net.QuicSession.HandshakeConfirmedTime", |
843 connect_timing_.connect_end - connect_timing_.connect_start); | 859 connect_timing_.connect_end - connect_timing_.connect_start); |
| 860 |
| 861 if (server_info_) { |
| 862 // TODO(rtenneti): Should we delete this histogram? |
| 863 // Track how long it has taken to finish handshake once we start waiting |
| 864 // for reading of QUIC server information from disk cache. We could use |
| 865 // this data to compare total time taken if we were to cancel the disk |
| 866 // cache read vs waiting for the read to complete. |
| 867 base::TimeTicks wait_for_data_start_time = |
| 868 server_info_->wait_for_data_start_time(); |
| 869 if (!wait_for_data_start_time.is_null()) { |
| 870 UMA_HISTOGRAM_TIMES( |
| 871 "Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime", |
| 872 base::TimeTicks::Now() - wait_for_data_start_time); |
| 873 } |
| 874 } |
844 // Track how long it has taken to finish handshake after we have finished | 875 // Track how long it has taken to finish handshake after we have finished |
845 // DNS host resolution. | 876 // DNS host resolution. |
846 if (!connect_timing_.dns_end.is_null()) { | 877 if (!connect_timing_.dns_end.is_null()) { |
847 UMA_HISTOGRAM_TIMES( | 878 UMA_HISTOGRAM_TIMES( |
848 "Net.QuicSession.HostResolution.HandshakeConfirmedTime", | 879 "Net.QuicSession.HostResolution.HandshakeConfirmedTime", |
849 base::TimeTicks::Now() - connect_timing_.dns_end); | 880 base::TimeTicks::Now() - connect_timing_.dns_end); |
850 } | 881 } |
851 | 882 |
852 ObserverSet::iterator it = observers_.begin(); | 883 ObserverSet::iterator it = observers_.begin(); |
853 while (it != observers_.end()) { | 884 while (it != observers_.end()) { |
854 Observer* observer = *it; | 885 Observer* observer = *it; |
855 ++it; | 886 ++it; |
856 observer->OnCryptoHandshakeConfirmed(); | 887 observer->OnCryptoHandshakeConfirmed(); |
857 } | 888 } |
| 889 if (server_info_) |
| 890 server_info_->OnExternalCacheHit(); |
858 } | 891 } |
859 QuicSpdySession::OnCryptoHandshakeEvent(event); | 892 QuicSpdySession::OnCryptoHandshakeEvent(event); |
860 } | 893 } |
861 | 894 |
862 void QuicChromiumClientSession::OnCryptoHandshakeMessageSent( | 895 void QuicChromiumClientSession::OnCryptoHandshakeMessageSent( |
863 const CryptoHandshakeMessage& message) { | 896 const CryptoHandshakeMessage& message) { |
864 logger_->OnCryptoHandshakeMessageSent(message); | 897 logger_->OnCryptoHandshakeMessageSent(message); |
865 } | 898 } |
866 | 899 |
867 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( | 900 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 } | 1516 } |
1484 | 1517 |
1485 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { | 1518 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { |
1486 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's | 1519 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's |
1487 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and | 1520 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and |
1488 // unacked packet map. | 1521 // unacked packet map. |
1489 return base::trace_event::EstimateMemoryUsage(packet_readers_); | 1522 return base::trace_event::EstimateMemoryUsage(packet_readers_); |
1490 } | 1523 } |
1491 | 1524 |
1492 } // namespace net | 1525 } // namespace net |
OLD | NEW |