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

Unified Diff: chrome/browser/prerender/prerender_histograms.cc

Issue 2653463005: Prerender: update historgram utility functions. (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_histograms.cc
diff --git a/chrome/browser/prerender/prerender_histograms.cc b/chrome/browser/prerender/prerender_histograms.cc
index d7ea7309607e65c57d8c91aa51bf9107d45037cc..2a7c5a3e634d0efcb90ad0724556df0b79d44704 100644
--- a/chrome/browser/prerender/prerender_histograms.cc
+++ b/chrome/browser/prerender/prerender_histograms.cc
@@ -36,31 +36,6 @@ int GetResourceType(bool is_main_resource, bool is_redirect, bool is_no_store) {
(is_main_resource * MAIN_RESOURCE);
}
-// Similar to UMA_HISTOGRAM_ENUMERATION but allows a dynamic histogram name.
-// Records a sample such as 0 <= sample < bucket_count, in a histogram with
-// |bucket_count| buckets of width 1 each.
-void RecordHistogramEnum(const std::string& histogram_name,
- base::HistogramBase::Sample sample,
- base::HistogramBase::Sample bucket_count) {
- DCHECK_LT(sample, bucket_count);
- base::HistogramBase* histogram_pointer = base::LinearHistogram::FactoryGet(
- histogram_name, 1, bucket_count, bucket_count + 1,
- base::HistogramBase::kUmaTargetedHistogramFlag);
- histogram_pointer->Add(sample);
-}
-
-// Similar to UMA_HISTOGRAM_CUSTOM_TIMES but allows a dynamic histogram name.
-void RecordHistogramTime(const std::string& histogram_name,
- base::TimeDelta time_min,
- base::TimeDelta time_max,
- base::TimeDelta sample,
- base::HistogramBase::Sample bucket_count) {
- base::HistogramBase* histogram_pointer = base::Histogram::FactoryTimeGet(
- histogram_name, time_min, time_max, bucket_count,
- base::HistogramBase::kUmaTargetedHistogramFlag);
- histogram_pointer->AddTime(sample);
-}
-
// Time window for which we will record windowed PLTs from the last observed
// link rel=prefetch tag. This is not intended to be the same as the prerender
// ttl, it's just intended to be a window during which a prerender has likely
@@ -440,8 +415,8 @@ void PrerenderHistograms::RecordPrefetchResponseReceived(
int sample = GetResourceType(is_main_resource, is_redirect, is_no_store);
std::string histogram_name =
GetHistogramName(origin, IsOriginWash(), "NoStatePrefetchResponseTypes");
- RecordHistogramEnum(histogram_name, sample,
- NO_STATE_PREFETCH_RESPONSE_TYPE_COUNT);
+ base::UmaHistogramExactLinear(histogram_name, sample,
+ NO_STATE_PREFETCH_RESPONSE_TYPE_COUNT);
}
void PrerenderHistograms::RecordPrefetchRedirectCount(
@@ -455,7 +430,8 @@ void PrerenderHistograms::RecordPrefetchRedirectCount(
"NoStatePrefetch%sResourceRedirects", is_main_resource ? "Main" : "Sub");
std::string histogram_name =
GetHistogramName(origin, IsOriginWash(), histogram_base_name);
- RecordHistogramEnum(histogram_name, redirect_count, kMaxRedirectCount);
+ base::UmaHistogramExactLinear(histogram_name, redirect_count,
+ kMaxRedirectCount);
}
void PrerenderHistograms::RecordPrefetchFirstContentfulPaintTime(
@@ -468,9 +444,10 @@ void PrerenderHistograms::RecordPrefetchFirstContentfulPaintTime(
if (!prefetch_age.is_zero()) {
DCHECK_NE(origin, ORIGIN_NONE);
- RecordHistogramTime(GetHistogramName(origin, IsOriginWash(), "PrefetchAge"),
- base::TimeDelta::FromMilliseconds(10),
- base::TimeDelta::FromMinutes(30), prefetch_age, 50);
+ base::UmaHistogramCustomTimes(
+ GetHistogramName(origin, IsOriginWash(), "PrefetchAge"), prefetch_age,
+ base::TimeDelta::FromMilliseconds(10), base::TimeDelta::FromMinutes(30),
+ 50);
}
std::string histogram_base_name;
@@ -488,8 +465,9 @@ void PrerenderHistograms::RecordPrefetchFirstContentfulPaintTime(
std::string histogram_name =
GetHistogramName(origin, IsOriginWash(), histogram_base_name);
- RecordHistogramTime(histogram_name, base::TimeDelta::FromMilliseconds(10),
- base::TimeDelta::FromMinutes(2), time, 50);
+ base::UmaHistogramCustomTimes(histogram_name, time,
+ base::TimeDelta::FromMilliseconds(10),
+ base::TimeDelta::FromMinutes(2), 50);
}
bool PrerenderHistograms::IsOriginWash() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698