diff options
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(); |