Chromium Code Reviews| 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 00c7816705d3638bc190824bbf3f7101bc93150f..54165c907d2565e214777bfeac826651388f2f55 100644 |
| --- a/chrome/browser/metrics/variations/variations_service.cc |
| +++ b/chrome/browser/metrics/variations/variations_service.cc |
| @@ -177,6 +177,19 @@ bool VariationsService::CreateTrialsFromSeed() { |
| } |
| } |
| + // 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. |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Variations.SeedFreshness", delta.InMinutes(), |
| + 1, base::TimeDelta::FromDays(30).InMinutes(), 50); |
| + } |
| + |
| return true; |
| } |
| @@ -215,6 +228,7 @@ void VariationsService::RegisterPrefs(PrefRegistrySimple* registry) { |
| registry->RegisterStringPref(prefs::kVariationsSeed, std::string()); |
| registry->RegisterInt64Pref(prefs::kVariationsSeedDate, |
| base::Time().ToInternalValue()); |
| + registry->RegisterInt64Pref(prefs::kVariationsLastFetchTime, 0); |
| } |
| // static |
| @@ -288,6 +302,10 @@ void VariationsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| base::TimeDelta::FromMilliseconds(kServerTimeResolutionMs), |
| latency); |
| } |
| + |
| + // Record the time of the most recent successful fetch. |
| + local_state_->SetInt64(prefs::kVariationsLastFetchTime, |
|
Alexei Svitkine (slow)
2013/02/22 18:46:51
Hmm, one little issue with doing this here is that
SteveT
2013/02/22 20:15:36
What do you think of this latest change? Another o
|
| + base::Time::Now().ToInternalValue()); |
| } |
| if (response_code != net::HTTP_OK) { |