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

Unified Diff: components/network_time/network_time_tracker.cc

Issue 2565173006: Measure time between secure time queries (Closed)
Patch Set: meacer comments Created 4 years 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: components/network_time/network_time_tracker.cc
diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc
index 89d2ad7f9d27e0912092d840b49ee7e29e410de1..f1017741e325f80a233ae823dc25ac20f9532233 100644
--- a/components/network_time/network_time_tracker.cc
+++ b/components/network_time/network_time_tracker.cc
@@ -534,8 +534,19 @@ bool NetworkTimeTracker::UpdateTimeFromResponse() {
base::TimeDelta resolution =
base::TimeDelta::FromMilliseconds(1) +
base::TimeDelta::FromSeconds(kTimeServerMaxSkewSeconds);
+
+ // Record histograms for the latency of the time query and the time delta
+ // between time fetches.
base::TimeDelta latency = tick_clock_->NowTicks() - fetch_started_;
UMA_HISTOGRAM_TIMES("NetworkTimeTracker.TimeQueryLatency", latency);
+ if (!last_fetched_time_.is_null()) {
+ UMA_HISTOGRAM_CUSTOM_TIMES("NetworkTimeTracker.TimeBetweenFetches",
+ current_time - last_fetched_time_,
+ base::TimeDelta::FromHours(1),
+ base::TimeDelta::FromDays(7), 50);
+ }
+ last_fetched_time_ = current_time;
+
UpdateNetworkTime(current_time, resolution, latency, tick_clock_->NowTicks());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698