| Index: base/android/record_histogram.cc
|
| diff --git a/base/android/record_histogram.cc b/base/android/record_histogram.cc
|
| index 0df0487ce8eaef337f6f2df2b62a5b4fad005e1a..8b7f7bd1d96df21b94b6d36d705dc0647735a071 100644
|
| --- a/base/android/record_histogram.cc
|
| +++ b/base/android/record_histogram.cc
|
| @@ -60,6 +60,31 @@ class HistogramCache {
|
| return InsertLocked(j_histogram_key, histogram);
|
| }
|
|
|
| + HistogramBase* CountHistogram(JNIEnv* env,
|
| + jstring j_histogram_name,
|
| + jint j_histogram_key) {
|
| + // These values are based on the hard-coded constants in the
|
| + // UMA_HISTOGRAM_COUNTS macro from base/metrics/histogram_macros.h.
|
| + const int histogram_min = 1;
|
| + const int histogram_max = 1000000;
|
| + const int histogram_num_buckets = 50;
|
| +
|
| + DCHECK(j_histogram_name);
|
| + DCHECK(j_histogram_key);
|
| + HistogramBase* histogram = FindLocked(j_histogram_key);
|
| + if (histogram) {
|
| + DCHECK(histogram->HasConstructionArguments(histogram_min, histogram_max,
|
| + histogram_num_buckets));
|
| + return histogram;
|
| + }
|
| +
|
| + std::string histogram_name = ConvertJavaStringToUTF8(env, j_histogram_name);
|
| + histogram = Histogram::FactoryGet(histogram_name, histogram_min,
|
| + histogram_max, histogram_num_buckets,
|
| + HistogramBase::kUmaTargetedHistogramFlag);
|
| + return InsertLocked(j_histogram_key, histogram);
|
| + }
|
| +
|
| HistogramBase* CustomTimesHistogram(JNIEnv* env,
|
| jstring j_histogram_name,
|
| jint j_histogram_key,
|
| @@ -133,6 +158,18 @@ void RecordEnumeratedHistogram(JNIEnv* env,
|
| ->Add(sample);
|
| }
|
|
|
| +void RecordCountHistogram(JNIEnv* env,
|
| + jclass clazz,
|
| + jstring j_histogram_name,
|
| + jint j_histogram_key,
|
| + jint j_sample) {
|
| + int sample = static_cast<int>(j_sample);
|
| +
|
| + g_histograms.Get()
|
| + .CountHistogram(env, j_histogram_name, j_histogram_key)
|
| + ->Add(sample);
|
| +}
|
| +
|
| void RecordCustomTimesHistogramMilliseconds(JNIEnv* env,
|
| jclass clazz,
|
| jstring j_histogram_name,
|
|
|