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

Unified Diff: chrome/browser/metrics/variations/variations_service.cc

Issue 631353002: Add 4 Variations.SeedDateSkew.* histograms to analyze whether the system clock or the build time co… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 2 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/variations/variations_service.cc
diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc
index 8a56747038c32a04bbc09bcb76f8f3c54bdffba5..2bc0786979cd1577ad03ac6e9578301038456689 100644
--- a/chrome/browser/metrics/variations/variations_service.cc
+++ b/chrome/browser/metrics/variations/variations_service.cc
@@ -276,12 +276,13 @@ bool VariationsService::CreateTrialsFromSeed() {
GetHardwareClass(),
base::Bind(&OverrideUIString));
+ const base::Time now = base::Time::Now();
+
// Log the "freshness" of the seed that was just used. The freshness is the
// time between the last successful seed download and now.
const int64 last_fetch_time_internal =
local_state_->GetInt64(prefs::kVariationsLastFetchTime);
if (last_fetch_time_internal) {
- const base::Time now = base::Time::Now();
const base::TimeDelta delta =
now - base::Time::FromInternalValue(last_fetch_time_internal);
// Log the value in number of minutes.
@@ -289,6 +290,34 @@ bool VariationsService::CreateTrialsFromSeed() {
1, base::TimeDelta::FromDays(30).InMinutes(), 50);
}
+ // Log the skew between the seed date and the system clock/build time to
+ // analyze whether either could be used to make old variations seeds expire
+ // after some time.
+ const int64 seed_date_internal =
+ local_state_->GetInt64(prefs::kVariationsSeedDate);
+ if (seed_date_internal) {
+ const base::Time seed_date =
+ base::Time::FromInternalValue(seed_date_internal);
+ const int system_clock_delta_days = (now - seed_date).InDays();
+ if (system_clock_delta_days < 0) {
+ UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.SystemClockBehindBy",
+ -system_clock_delta_days);
+ } else {
+ UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.SystemClockAheadBy",
+ system_clock_delta_days);
+ }
+
+ const int build_time_delta_days =
+ (base::GetBuildTime() - seed_date).InDays();
+ if (build_time_delta_days < 0) {
+ UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.BuildTimeBehindBy",
+ -build_time_delta_days);
+ } else {
+ UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.BuildTimeAheadBy",
+ build_time_delta_days);
+ }
+ }
+
return true;
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698