Index: base/android/record_histogram.cc |
diff --git a/base/android/record_histogram.cc b/base/android/record_histogram.cc |
index 9a68deca54f420aa2136608dc9b097b2f08fb27a..0688e4f4ba799f928aa7699fa4cb9aa014398b26 100644 |
--- a/base/android/record_histogram.cc |
+++ b/base/android/record_histogram.cc |
@@ -85,6 +85,30 @@ class HistogramCache { |
return InsertLocked(j_histogram_key, histogram); |
} |
+ HistogramBase* LinearCountHistogram(JNIEnv* env, |
+ jstring j_histogram_name, |
+ jint j_histogram_key, |
+ jint j_min, |
+ jint j_max, |
+ jint j_num_buckets) { |
+ DCHECK(j_histogram_name); |
+ DCHECK(j_histogram_key); |
+ int64 min = static_cast<int64>(j_min); |
+ int64 max = static_cast<int64>(j_max); |
+ int num_buckets = static_cast<int>(j_num_buckets); |
+ HistogramBase* histogram = FindLocked(j_histogram_key); |
+ if (histogram) { |
+ DCHECK(histogram->HasConstructionArguments(min, max, num_buckets)); |
+ return histogram; |
+ } |
+ |
+ std::string histogram_name = ConvertJavaStringToUTF8(env, j_histogram_name); |
+ histogram = |
+ LinearHistogram::FactoryGet(histogram_name, min, max, num_buckets, |
+ HistogramBase::kUmaTargetedHistogramFlag); |
+ return InsertLocked(j_histogram_key, histogram); |
+ } |
+ |
HistogramBase* SparseHistogram(JNIEnv* env, |
jstring j_histogram_name, |
jint j_histogram_key) { |
@@ -189,6 +213,22 @@ void RecordCustomCountHistogram(JNIEnv* env, |
->Add(sample); |
} |
+void RecordLinearCountHistogram(JNIEnv* env, |
+ jclass clazz, |
+ jstring j_histogram_name, |
+ jint j_histogram_key, |
+ jint j_sample, |
+ jint j_min, |
+ jint j_max, |
+ jint j_num_buckets) { |
+ int sample = static_cast<int>(j_sample); |
+ |
+ g_histograms.Get() |
+ .LinearCountHistogram(env, j_histogram_name, j_histogram_key, j_min, |
+ j_max, j_num_buckets) |
+ ->Add(sample); |
+} |
+ |
void RecordSparseHistogram(JNIEnv* env, |
jclass clazz, |
jstring j_histogram_name, |