Chromium Code Reviews| Index: net/proxy/proxy_script_fetcher_impl.cc |
| diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc |
| index 290363be6e49cf4de509bbd7f0d075e062cb3c6d..6534150a471f14f03a32efc9ea21f399796d0ae0 100644 |
| --- a/net/proxy/proxy_script_fetcher_impl.cc |
| +++ b/net/proxy/proxy_script_fetcher_impl.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/compiler_specific.h" |
| #include "base/location.h" |
| #include "base/logging.h" |
| +#include "base/metrics/histogram.h" |
| #include "base/single_thread_task_runner.h" |
| #include "base/strings/string_util.h" |
| #include "base/thread_task_runner_handle.h" |
| @@ -133,6 +134,9 @@ int ProxyScriptFetcherImpl::Fetch( |
| return OK; |
| } |
| + DCHECK(fetch_start_time_.is_null()); |
| + fetch_start_time_ = base::Time::Now(); |
|
eroman
2015/07/13 21:39:04
I suggest using base::TimeTicks over base::Time fo
|
| + |
| cur_request_ = |
| url_request_context_->CreateRequest(url, DEFAULT_PRIORITY, this); |
| cur_request_->set_method("GET"); |
| @@ -282,6 +286,11 @@ bool ProxyScriptFetcherImpl::ConsumeBytesRead(URLRequest* request, |
| void ProxyScriptFetcherImpl::FetchCompleted() { |
| if (result_code_ == OK) { |
| + // Calculate duration of time for proxy script fetch to complete. |
| + DCHECK(!fetch_start_time_.is_null()); |
| + UMA_HISTOGRAM_TIMES("Net.ProxyScriptFetcher.SuccessDuration", |
|
eroman
2015/07/13 21:39:04
I see you considered putting it in ProxyScriptDeci
|
| + base::Time::Now() - fetch_start_time_); |
| + |
| // The caller expects the response to be encoded as UTF16. |
| std::string charset; |
| cur_request_->GetCharset(&charset); |
| @@ -305,6 +314,7 @@ void ProxyScriptFetcherImpl::ResetCurRequestState() { |
| callback_.Reset(); |
| result_code_ = OK; |
| result_text_ = NULL; |
| + fetch_start_time_ = base::Time(); |
| } |
| void ProxyScriptFetcherImpl::OnTimeout(int id) { |