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

Unified Diff: net/dns/dns_config_service.cc

Issue 10543168: [net/dns] Instrument DnsConfigService to measure performance and failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test expectations on win' Created 8 years, 6 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/dns/dns_config_service.cc
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc
index bff1fc709f8df5d1b9f1e26f75dccf8e73b97573..f17e32b73048a08a4ec84f2ac1c84eeb2ef1795c 100644
--- a/net/dns/dns_config_service.cc
+++ b/net/dns/dns_config_service.cc
@@ -5,6 +5,7 @@
#include "net/dns/dns_config_service.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/values.h"
#include "net/base/ip_endpoint.h"
@@ -104,6 +105,12 @@ void DnsConfigService::Watch(const CallbackType& callback) {
void DnsConfigService::InvalidateConfig() {
DCHECK(CalledOnValidThread());
+ base::TimeTicks now = base::TimeTicks::Now();
+ if (!last_invalidate_config_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("AsyncDNS.ConfigNotifyInterval",
+ now - last_invalidate_config_time_);
+ }
+ last_invalidate_config_time_ = now;
if (!have_config_)
return;
have_config_ = false;
@@ -112,6 +119,12 @@ void DnsConfigService::InvalidateConfig() {
void DnsConfigService::InvalidateHosts() {
DCHECK(CalledOnValidThread());
+ base::TimeTicks now = base::TimeTicks::Now();
+ if (!last_invalidate_hosts_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("AsyncDNS.HostsNotifyInterval",
+ now - last_invalidate_hosts_time_);
+ }
+ last_invalidate_hosts_time_ = now;
if (!have_hosts_)
return;
have_hosts_ = false;
@@ -122,10 +135,17 @@ void DnsConfigService::OnConfigRead(const DnsConfig& config) {
DCHECK(CalledOnValidThread());
DCHECK(config.IsValid());
+ bool changed = false;
if (!config.EqualsIgnoreHosts(dns_config_)) {
dns_config_.CopyIgnoreHosts(config);
need_update_ = true;
+ changed = true;
}
+ if (!changed && !last_sent_empty_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("AsyncDNS.UnchangedConfigInterval",
+ base::TimeTicks::Now() - last_sent_empty_time_);
+ }
+ UMA_HISTOGRAM_BOOLEAN("AsyncDNS.ConfigChange", changed);
have_config_ = true;
if (have_hosts_)
@@ -135,10 +155,17 @@ void DnsConfigService::OnConfigRead(const DnsConfig& config) {
void DnsConfigService::OnHostsRead(const DnsHosts& hosts) {
DCHECK(CalledOnValidThread());
+ bool changed = false;
if (hosts != dns_config_.hosts) {
dns_config_.hosts = hosts;
need_update_ = true;
+ changed = true;
+ }
+ if (!changed && !last_sent_empty_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("AsyncDNS.UnchangedHostsInterval",
+ base::TimeTicks::Now() - last_sent_empty_time_);
}
+ UMA_HISTOGRAM_BOOLEAN("AsyncDNS.HostsChange", changed);
have_hosts_ = true;
if (have_config_)
@@ -178,6 +205,7 @@ void DnsConfigService::OnTimeout() {
need_update_ = true;
// Empty config is considered invalid.
last_sent_empty_ = true;
+ last_sent_empty_time_ = base::TimeTicks::Now();
callback_.Run(DnsConfig());
}

Powered by Google App Engine
This is Rietveld 408576698