diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 01:51:14 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 01:51:14 +0000 |
commit | a98662d79f3890dfb3eaed7e01e12f46c3b7c4dc (patch) | |
tree | 9e9d6b37241703f06ecf001d537a48255a2ff917 /net | |
parent | 4a052f2209adf8ae18793d06006dc06eb31e52ee (diff) | |
download | chromium_src-a98662d79f3890dfb3eaed7e01e12f46c3b7c4dc.zip chromium_src-a98662d79f3890dfb3eaed7e01e12f46c3b7c4dc.tar.gz chromium_src-a98662d79f3890dfb3eaed7e01e12f46c3b7c4dc.tar.bz2 |
Record network latency stats for Win HTTP in a histogram
r=wtc
Review URL: http://codereview.chromium.org/12972
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_transaction_winhttp.cc | 12 | ||||
-rw-r--r-- | net/http/http_transaction_winhttp.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc index aa52faf..20019ef 100644 --- a/net/http/http_transaction_winhttp.cc +++ b/net/http/http_transaction_winhttp.cc @@ -977,8 +977,10 @@ int HttpTransactionWinHttp::Read(char* buf, int buf_len, DCHECK(request_handle_); // If we have already received the full response, then we know we are done. - if (content_length_remaining_ == 0) + if (content_length_remaining_ == 0) { + LogTransactionMetrics(); return 0; + } session_callback_->set_read_buf(buf); session_callback_->set_read_buf_len(buf_len); @@ -1439,6 +1441,7 @@ int HttpTransactionWinHttp::DidReadData(DWORD num_bytes) { // We have read the entire response. Mark the request done to unblock a // queued request. if (rv == 0) { + LogTransactionMetrics(); DCHECK(request_submitted_); request_submitted_ = false; session_->request_throttle()->NotifyRequestDone(connect_peer_); @@ -1447,6 +1450,13 @@ int HttpTransactionWinHttp::DidReadData(DWORD num_bytes) { return rv; } +void HttpTransactionWinHttp::LogTransactionMetrics() const { + base::TimeDelta duration = base::Time::Now() - response_.request_time; + if (60 < duration.InMinutes()) + return; + UMA_HISTOGRAM_LONG_TIMES(L"Net.Transaction_Latency_WinHTTP", duration); +} + int HttpTransactionWinHttp::DidReceiveHeaders() { session_callback_->set_load_state(LOAD_STATE_IDLE); diff --git a/net/http/http_transaction_winhttp.h b/net/http/http_transaction_winhttp.h index 46b69d8..3d46306 100644 --- a/net/http/http_transaction_winhttp.h +++ b/net/http/http_transaction_winhttp.h @@ -93,6 +93,7 @@ class HttpTransactionWinHttp : public HttpTransaction { int DidSendRequest(); int DidWriteData(DWORD num_bytes); int DidReadData(DWORD num_bytes); + void LogTransactionMetrics() const; int DidReceiveHeaders(); int PopulateAuthChallenge(); |