Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index b3d3be442d3247fdec861484230f9b7d876d095a..3a7815d4a8168cc8949ce28ca844052b57508879 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -13,8 +13,10 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/message_loop/message_loop_proxy.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/strings/string_util.h" |
| #include "base/thread_task_runner_handle.h" |
| +#include "base/time/time.h" |
| #include "base/values.h" |
| #include "net/base/completion_callback.h" |
| #include "net/base/load_flags.h" |
| @@ -796,7 +798,8 @@ class ProxyService::PacRequest |
| resolve_job_(NULL), |
| config_id_(ProxyConfig::kInvalidConfigID), |
| config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), |
| - net_log_(net_log) { |
| + net_log_(net_log), |
| + request_start_time_(TimeTicks::Now()) { |
| DCHECK(!user_callback.is_null()); |
| } |
| @@ -884,6 +887,12 @@ class ProxyService::PacRequest |
| config_id_ = ProxyConfig::kInvalidConfigID; |
| config_source_ = PROXY_CONFIG_SOURCE_UNKNOWN; |
| + UMA_HISTOGRAM_CUSTOM_TIMES( |
| + "Net.ProxyService.ResolveTime", |
| + results_->proxy_resolve_end_time_ - request_start_time_, |
| + base::TimeDelta::FromMicroseconds(100), |
| + base::TimeDelta::FromSeconds(10), 50); |
|
eroman
2015/05/05 23:51:28
I don't think the upper range is high enough.
I su
Anand Mistry (off Chromium)
2015/05/06 06:52:18
Done.
|
| + |
| return rv; |
| } |
| @@ -931,6 +940,8 @@ class ProxyService::PacRequest |
| // Time when the PAC is started. Cached here since resetting ProxyInfo also |
| // clears the proxy times. |
| TimeTicks proxy_resolve_start_time_; |
| + // Time when this request is created. |
| + TimeTicks request_start_time_; |
| }; |
| // ProxyService --------------------------------------------------------------- |
| @@ -1066,6 +1077,8 @@ int ProxyService::ResolveProxyHelper(const GURL& raw_url, |
| // using a direct connection for example). |
| int rv = TryToCompleteSynchronously(url, load_flags, |
| network_delegate, result); |
| + UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedSynchronously", |
|
eroman
2015/05/05 23:51:29
This is incomplete. Requests can also be completed
Anand Mistry (off Chromium)
2015/05/06 06:52:18
I've changed these around. I hope they're better.
|
| + rv != ERR_IO_PENDING); |
| if (rv != ERR_IO_PENDING) |
| return DidFinishResolvingProxy(url, load_flags, network_delegate, |
| result, rv, net_log); |
| @@ -1379,6 +1392,11 @@ int ProxyService::DidFinishResolvingProxy(const GURL& url, |
| ProxyInfo* result, |
| int result_code, |
| const BoundNetLog& net_log) { |
| + // This function "fixes" the result code, so make sure script terminated |
| + // errors are tracked. |
| + UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", |
| + result_code == ERR_PAC_SCRIPT_TERMINATED); |
| + |
| // Log the result of the proxy resolution. |
| if (result_code == OK) { |
| // Allow the network delegate to interpose on the resolution decision, |