summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-15 16:42:45 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-15 16:42:45 +0000
commit1e9bbd23e23395eb4d0566b768452f90530de638 (patch)
treed2c683d76c9bf3648f994f0d8f50b694d4784024 /net/base/host_resolver_impl.cc
parenta0c5e4b399d66df2704533d1ffbdd1516744367f (diff)
downloadchromium_src-1e9bbd23e23395eb4d0566b768452f90530de638.zip
chromium_src-1e9bbd23e23395eb4d0566b768452f90530de638.tar.gz
chromium_src-1e9bbd23e23395eb4d0566b768452f90530de638.tar.bz2
Add performance histograms to resolver, asong with A/B test
I'm doing tests to see what the impact of changing the speculative resolution system parameters is on resolution time. By default, the speculative system limits itself to no more than 8 pending resolutions at any time, and this test looks at 6, 4, and 2 as limits. It also modulates the speculative congestion avoidance system, which purges the speculative queue when there is too much resolution latency, and tries various durations of time. (the latter was less important... but was already part of this existing A/B test.) I also pushed the test rates up to 10% for each case, so that we'd get data from the canary and/or dev builds. r=eroman Review URL: http://codereview.chromium.org/3762006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.cc')
-rw-r--r--net/base/host_resolver_impl.cc74
1 files changed, 61 insertions, 13 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 70f946f..5ee66ff 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -19,6 +19,7 @@
#include "base/debug_util.h"
#include "base/lock.h"
#include "base/message_loop.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
@@ -217,6 +218,8 @@ std::vector<int> GetAllGetAddrinfoOSErrors() {
WSANOTINITIALISED,
WSATRY_AGAIN,
WSATYPE_NOT_FOUND,
+ // The following are not in doc, but might be to appearing in results :-(.
+ WSA_INVALID_HANDLE,
#endif
};
@@ -322,7 +325,12 @@ class HostResolverImpl::Request {
DISALLOW_COPY_AND_ASSIGN(Request);
};
-//-----------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+// Provide a common macro to simplify code and readability. We must use a
+// macros as the underlying HISTOGRAM macro creates static varibles.
+#define DNS_HISTOGRAM(name, time) UMA_HISTOGRAM_CUSTOM_TIMES(name, time, \
+ base::TimeDelta::FromMicroseconds(1), base::TimeDelta::FromHours(1), 100)
// This class represents a request to the worker pool for a "getaddrinfo()"
// call.
@@ -490,18 +498,7 @@ class HostResolverImpl::Job
if (error_ != OK && NetworkChangeNotifier::IsOffline())
error_ = ERR_INTERNET_DISCONNECTED;
- base::TimeDelta job_duration = base::TimeTicks::Now() - start_time_;
-
- if (had_non_speculative_request_) {
- // TODO(eroman): Add histogram for job times of non-speculative
- // requests.
- }
-
- if (error_ != OK) {
- UMA_HISTOGRAM_CUSTOM_ENUMERATION(kOSErrorsForGetAddrinfoHistogramName,
- std::abs(os_error_),
- GetAllGetAddrinfoOSErrors());
- }
+ RecordPerformanceHistograms();
if (was_cancelled())
return;
@@ -526,6 +523,57 @@ class HostResolverImpl::Job
resolver_->OnJobComplete(this, error_, os_error_, results_);
}
+ void RecordPerformanceHistograms() const {
+ enum Category { // Used in HISTOGRAM_ENUMERATION.
+ RESOLVE_SUCCESS,
+ RESOLVE_FAIL,
+ RESOLVE_SPECULATIVE_SUCCESS,
+ RESOLVE_SPECULATIVE_FAIL,
+ RESOLVE_MAX, // Bounding value.
+ };
+ int category = RESOLVE_MAX; // Illegal value for later DCHECK only.
+
+ base::TimeDelta duration = base::TimeTicks::Now() - start_time_;
+ if (error_ == OK) {
+ if (had_non_speculative_request_) {
+ category = RESOLVE_SUCCESS;
+ DNS_HISTOGRAM("DNS.ResolveSuccess", duration);
+ } else {
+ category = RESOLVE_SPECULATIVE_SUCCESS;
+ DNS_HISTOGRAM("DNS.ResolveSpeculativeSuccess", duration);
+ }
+ } else {
+ if (had_non_speculative_request_) {
+ category = RESOLVE_FAIL;
+ DNS_HISTOGRAM("DNS.ResolveFail", duration);
+ } else {
+ category = RESOLVE_SPECULATIVE_FAIL;
+ DNS_HISTOGRAM("DNS.ResolveSpeculativeFail", duration);
+ }
+ UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.OSErrorsForGetAddrinfo",
+ std::abs(os_error_),
+ GetAllGetAddrinfoOSErrors());
+ }
+ DCHECK_LT(category, RESOLVE_MAX); // Be sure it was set.
+
+ UMA_HISTOGRAM_ENUMERATION("DNS.ResolveCategory", category, RESOLVE_MAX);
+
+ static bool show_experiment_histograms =
+ base::FieldTrialList::Find("DnsImpact") &&
+ !base::FieldTrialList::Find("DnsImpact")->group_name().empty();
+ if (show_experiment_histograms) {
+ UMA_HISTOGRAM_ENUMERATION(
+ base::FieldTrial::MakeName("DNS.ResolveCategory", "DnsImpact"),
+ category, RESOLVE_MAX);
+ if (RESOLVE_SUCCESS == category) {
+ DNS_HISTOGRAM(base::FieldTrial::MakeName("DNS.ResolveSuccess",
+ "DnsImpact"), duration);
+ }
+ }
+ }
+
+
+
// Immutable. Can be read from either thread,
const int id_;