diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 20:57:35 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 20:57:35 +0000 |
commit | fe42cb3a23f77b24796521792ad3f0e89f81f2ec (patch) | |
tree | 6184bf75bccbea11b673d49b87d4a3381013d94d /net/proxy | |
parent | 1038ecb77198ad02d6e6f8c4fbe46584a31f32fd (diff) | |
download | chromium_src-fe42cb3a23f77b24796521792ad3f0e89f81f2ec.zip chromium_src-fe42cb3a23f77b24796521792ad3f0e89f81f2ec.tar.gz chromium_src-fe42cb3a23f77b24796521792ad3f0e89f81f2ec.tar.bz2 |
Add histograms to measure the performance of multithreaded proxy resolving.
BUG=173045
Review URL: https://chromiumcodereview.appspot.com/12089063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/multi_threaded_proxy_resolver.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index de73913..bd9890c 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/message_loop_proxy.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/threading/thread.h" @@ -233,6 +234,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob url_(url), was_waiting_for_thread_(false) { DCHECK(!callback.is_null()); + start_time_ = base::TimeTicks::Now(); } BoundNetLog* net_log() { return &net_log_; } @@ -245,6 +247,8 @@ class MultiThreadedProxyResolver::GetProxyForURLJob virtual void FinishedWaitingForThread() OVERRIDE { DCHECK(executor()); + submitted_to_thread_time_ = base::TimeTicks::Now(); + if (was_waiting_for_thread_) { net_log_.EndEvent(NetLog::TYPE_WAITING_FOR_PROXY_RESOLVER_THREAD); } @@ -274,6 +278,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob void QueryComplete(int result_code) { // The Job may have been cancelled after it was started. if (!was_cancelled()) { + RecordPerformanceMetrics(); if (result_code >= OK) { // Note: unit-tests use values > 0. results_->Use(results_buf_); } @@ -282,6 +287,20 @@ class MultiThreadedProxyResolver::GetProxyForURLJob OnJobCompleted(); } + void RecordPerformanceMetrics() { + DCHECK(!was_cancelled()); + + base::TimeTicks now = base::TimeTicks::Now(); + + // Log the total time the request took to complete. + UMA_HISTOGRAM_MEDIUM_TIMES("Net.MTPR_GetProxyForUrl_Time", + now - start_time_); + + // Log the time the request was stalled waiting for a thread to free up. + UMA_HISTOGRAM_MEDIUM_TIMES("Net.MTPR_GetProxyForUrl_Thread_Wait_Time", + submitted_to_thread_time_ - start_time_); + } + // Must only be used on the "origin" thread. ProxyInfo* results_; @@ -292,6 +311,9 @@ class MultiThreadedProxyResolver::GetProxyForURLJob // Usable from within DoQuery on the worker thread. ProxyInfo results_buf_; + base::TimeTicks start_time_; + base::TimeTicks submitted_to_thread_time_; + bool was_waiting_for_thread_; }; |