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

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: Rebased. 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
« no previous file with comments | « net/dns/dns_config_service.h ('k') | net/dns/dns_config_service_posix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_config_service.cc
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc
index 43acf481007349962f73a8c31f82e1cd510313cf..a520d261b9dbe6ac2f53a5e786ff766eeb55634f 100644
--- a/net/dns/dns_config_service.cc
+++ b/net/dns/dns_config_service.cc
@@ -152,6 +152,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;
@@ -160,6 +166,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;
@@ -170,10 +182,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_)
@@ -183,10 +202,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_)
@@ -226,6 +252,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());
}
« no previous file with comments | « net/dns/dns_config_service.h ('k') | net/dns/dns_config_service_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698