Chromium Code Reviews| Index: base/android/record_histogram.cc |
| diff --git a/base/android/record_histogram.cc b/base/android/record_histogram.cc |
| index 9a68deca54f420aa2136608dc9b097b2f08fb27a..f531cdd1cf083131fd72ed484a8738be1e912759 100644 |
| --- a/base/android/record_histogram.cc |
| +++ b/base/android/record_histogram.cc |
| @@ -85,6 +85,29 @@ class HistogramCache { |
| return InsertLocked(j_histogram_key, histogram); |
| } |
| + HistogramBase* LinearCountHistogram(JNIEnv* env, |
| + jstring j_histogram_name, |
|
Yaron
2015/08/31 13:53:21
nit: fix indentation
|
| + 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); |
|
Yaron
2015/08/31 13:53:21
80 cols
|
| + histogram = |
| + LinearHistogram::FactoryGet(histogram_name, min, max, num_buckets, |
| + HistogramBase::kUmaTargetedHistogramFlag); |
|
Yaron
2015/08/31 13:53:21
nit: indentation
|
| + return InsertLocked(j_histogram_key, histogram); |
| + } |
| + |
| HistogramBase* SparseHistogram(JNIEnv* env, |
| jstring j_histogram_name, |
| jint j_histogram_key) { |
| @@ -189,6 +212,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, |