diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 23:23:03 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 23:23:03 +0000 |
commit | 9a0a55f53af05489e497aa4bc500cc1735c30713 (patch) | |
tree | bf52dc51bb1b3b36d195f364e4c62fe8cc0f8ca2 /net | |
parent | bfd979be48496fb638de3e0de3cc595d6947947f (diff) | |
download | chromium_src-9a0a55f53af05489e497aa4bc500cc1735c30713.zip chromium_src-9a0a55f53af05489e497aa4bc500cc1735c30713.tar.gz chromium_src-9a0a55f53af05489e497aa4bc500cc1735c30713.tar.bz2 |
Histogram time from request till first byte of header is received
Use this as part of the DNS testing trials.
r=wtc
Review URL: http://codereview.chromium.org/67083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_transaction.cc | 22 | ||||
-rw-r--r-- | net/http/http_network_transaction.h | 7 |
2 files changed, 22 insertions, 7 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index e69e8fe..aa5b691 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -761,8 +761,15 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) { // Record our best estimate of the 'response time' as the time when we read // the first bytes of the response headers. - if (header_buf_len_ == 0) + if (header_buf_len_ == 0) { + // After we call RestartWithAuth header_buf_len will be zero again, and + // we need to be cautious about incorrectly logging the duration across the + // authentication activitiy. + bool first_response = response_.response_time == Time(); response_.response_time = Time::Now(); + if (first_response) + LogTransactionConnectedMetrics(); + } // The socket was closed before we found end-of-headers. if (result == 0) { @@ -953,6 +960,15 @@ int HttpNetworkTransaction::DoDrainBodyForAuthRestartComplete(int result) { return OK; } +void HttpNetworkTransaction::LogTransactionConnectedMetrics() const { + base::TimeDelta total_duration = response_.response_time - start_time_; + + UMA_HISTOGRAM_CLIPPED_TIMES(FieldTrial::MakeName( + "Net.Transaction_Connected_Under_10", "DnsImpact").data(), total_duration, + base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), + 100); +} + void HttpNetworkTransaction::LogTransactionMetrics() const { base::TimeDelta duration = base::Time::Now() - response_.request_time; if (60 < duration.InMinutes()) @@ -977,10 +993,6 @@ void HttpNetworkTransaction::LogTransactionMetrics() const { total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); } - if (!duration.InMilliseconds()) - return; - UMA_HISTOGRAM_COUNTS("Net.Transaction_Bandwidth", - static_cast<int> (response_body_read_ / duration.InMilliseconds())); } void HttpNetworkTransaction::LogBlockedTunnelResponse( diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index 5fb48f1..d41d29d 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -8,6 +8,7 @@ #include <string> #include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "base/time.h" #include "net/base/address_list.h" #include "net/base/client_socket_handle.h" @@ -87,8 +88,10 @@ class HttpNetworkTransaction : public HttpTransaction { int DoDrainBodyForAuthRestart(); int DoDrainBodyForAuthRestartComplete(int result); - // Record histogram of latency (first byte sent till last byte received) as - // well as effective bandwidth used. + // Record histogram of time until first byte of header is received. + void LogTransactionConnectedMetrics() const; + + // Record histogram of latency (durations until last byte received). void LogTransactionMetrics() const; // Writes a log message to help debugging in the field when we block a proxy |