diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 18:42:55 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 18:42:55 +0000 |
commit | 56300171b8109fefd00bd823e9e387e63f55aeed (patch) | |
tree | ad2f37af673029618ca23970d9967e77d461cec7 /net | |
parent | 6a82cd0a96b12808fcdcb23dd6e018de44225566 (diff) | |
download | chromium_src-56300171b8109fefd00bd823e9e387e63f55aeed.zip chromium_src-56300171b8109fefd00bd823e9e387e63f55aeed.tar.gz chromium_src-56300171b8109fefd00bd823e9e387e63f55aeed.tar.bz2 |
Add histogram to show network latency (first byte to last byte)
Also added a histogram to show effective bandwidth of the download.
r=darin,wtc
Review URL: http://codereview.chromium.org/9625
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_transaction.cc | 12 | ||||
-rw-r--r-- | net/http/http_network_transaction.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 8e947f57..ae82b67 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -757,6 +757,7 @@ int HttpNetworkTransaction::DoReadBodyComplete(int result) { // Clean up the HttpConnection if we are done. if (done) { + LogTransactionMetrics(); if (!keep_alive) connection_.set_socket(NULL); connection_.Reset(); @@ -770,6 +771,17 @@ int HttpNetworkTransaction::DoReadBodyComplete(int result) { return result; } +void HttpNetworkTransaction::LogTransactionMetrics() const { + base::TimeDelta duration = base::Time::Now() - response_.request_time; + if (60 < duration.InMinutes()) + return; + UMA_HISTOGRAM_LONG_TIMES(L"Net.Transaction_Latency", duration); + if (!duration.InMilliseconds()) + return; + UMA_HISTOGRAM_COUNTS(L"Net.Transaction_Bandwidth", + static_cast<int> (content_read_ / duration.InMilliseconds())); +} + int HttpNetworkTransaction::DidReadResponseHeaders() { scoped_refptr<HttpResponseHeaders> headers; if (has_found_status_line_start()) { diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index dc850b5..2f733389 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -77,6 +77,10 @@ class HttpNetworkTransaction : public HttpTransaction { int DoReadBody(); int DoReadBodyComplete(int result); + // Record histogram of latency (first byte sent till last byte received) as + // well as effective bandwidth used. + void LogTransactionMetrics() const; + // Called when header_buf_ contains the complete response headers. int DidReadResponseHeaders(); |