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..6807d3d3127056ac5993c59d873929bd16e3786a 100644 |
| --- a/chrome/browser/metrics/variations/variations_service.cc |
| +++ b/chrome/browser/metrics/variations/variations_service.cc |
| @@ -215,6 +215,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 +289,25 @@ void VariationsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| base::TimeDelta::FromMilliseconds(kServerTimeResolutionMs), |
| latency); |
| } |
| + |
| + // If this is not the first successful fetch, record the delta between now |
| + // and the last successful fetch. |
| + int64 internal_now = base::Time::Now().ToInternalValue(); |
| + int64 last_fetch_time = |
| + local_state_->GetInt64(prefs::kVariationsLastFetchTime); |
| + if (last_fetch_time) { |
| + int64 internal_delta = internal_now - last_fetch_time; |
| + DCHECK_GE(internal_delta, 0); |
| + base::TimeDelta delta = |
| + base::TimeDelta::FromInternalValue(internal_delta); |
| + // Note that 10000 is approximately 7 days. |
| + UMA_HISTOGRAM_COUNTS_10000("Variations.SeedFreshness", |
|
Ilya Sherman
2013/02/22 00:31:28
You sure you don't want UMA_HISTOGRAM_CUSTOM_TIMES
SteveT
2013/02/22 00:38:37
Hmm, it's a little hard to parse what UMA_HISTOGRA
Ilya Sherman
2013/02/22 00:45:50
You give it bounds for the highest granularity of
SteveT
2013/02/22 01:01:02
So in my latest patch, I used UMA_HISTOGRAM_CUSTOM
Ilya Sherman
2013/02/22 01:12:07
Oh, I see what you mean. You're right, the units
SteveT
2013/02/22 01:26:41
Yeah, if the dashboard had a way to select the tim
|
| + delta.InMinutes()); |
| + } |
| + |
| + // Record the time of the most recent successful fetch. |
| + local_state_->SetInt64(prefs::kVariationsLastFetchTime, |
| + internal_now); |
| } |
| if (response_code != net::HTTP_OK) { |