Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: net/proxy/proxy_script_fetcher_impl.cc

Issue 1224343002: Add Net.ProxyScriptFetchSuccessDuration UMA to record how long PAC script fetches take. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename UMA to Net.ProxyScriptFetcher.SuccessDuration Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698