diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 22:12:52 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 22:12:52 +0000 |
commit | e87b8b518d43c0342367c0f710299a5dc9ef2e4b (patch) | |
tree | 553d0b320d8f8efa2e035c78500dd59878b85e4d /net/base | |
parent | a8acdc80f627ea5cc7f9a5d4b47f5dfc4e029d52 (diff) | |
download | chromium_src-e87b8b518d43c0342367c0f710299a5dc9ef2e4b.zip chromium_src-e87b8b518d43c0342367c0f710299a5dc9ef2e4b.tar.gz chromium_src-e87b8b518d43c0342367c0f710299a5dc9ef2e4b.tar.bz2 |
Added a metric to measure how much time is saved by having
spawned an extra attempt - when attempt 1 completes but a retry
attempt was used, log how much longer attempt 1 took.
BUG=85115
TEST=host resolver unit tests
R=eroman
Review URL: http://codereview.chromium.org/7104129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/host_resolver_impl.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 3b05b75..d404b7e 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -618,6 +618,12 @@ class HostResolverImpl::Job if (was_cancelled()) return; + if (was_retry_attempt) { + // If retry attempt finishes before 1st attempt, then get stats on how + // much time is saved by having spawned an extra attempt. + retry_attempt_finished_time_ = base::TimeTicks::Now(); + } + scoped_refptr<NetLog::EventParameters> params; if (error != OK) { params = new HostResolveFailedParams(0, error, os_error); @@ -733,6 +739,7 @@ class HostResolverImpl::Job const int os_error) const { bool first_attempt_to_complete = completed_attempt_number_ == attempt_number; + bool is_first_attempt = (attempt_number == 1); if (first_attempt_to_complete) { // If this was first attempt to complete, then record the resolution @@ -751,6 +758,13 @@ class HostResolverImpl::Job else UMA_HISTOGRAM_ENUMERATION("DNS.AttemptFailure", attempt_number, 100); + // If first attempt didn't finish before retry attempt, then calculate stats + // on how much time is saved by having spawned an extra attempt. + if (!first_attempt_to_complete && is_first_attempt && !was_cancelled()) { + DNS_HISTOGRAM("DNS.AttemptTimeSavedByRetry", + base::TimeTicks::Now() - retry_attempt_finished_time_); + } + if (was_cancelled() || !first_attempt_to_complete) { // Count those attempts which completed after the job was already canceled // OR after the job was already completed by an earlier attempt (so in @@ -804,6 +818,9 @@ class HostResolverImpl::Job // The result (a net error code) from the first attempt to complete. int completed_attempt_error_; + // The time when retry attempt was finished. + base::TimeTicks retry_attempt_finished_time_; + // True if a non-speculative request was ever attached to this job // (regardless of whether or not it was later cancelled. // This boolean is used for histogramming the duration of jobs used to |