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

Unified Diff: base/android/record_histogram.cc

Issue 2930553002: Add UMA metric to track the time elapsed since a WebAPK was last launched (Closed)
Patch Set: Merge branch 'master' into last_launched2 Created 3 years, 6 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
Index: base/android/record_histogram.cc
diff --git a/base/android/record_histogram.cc b/base/android/record_histogram.cc
index 1a207a18dc42b5d7fb91dd4cff45130017bc6c4c..05619866b5f02aa0ee36fa0df91e04b3d5942960 100644
--- a/base/android/record_histogram.cc
+++ b/base/android/record_histogram.cc
@@ -315,6 +315,20 @@ jint GetHistogramValueCountForTesting(
return samples->GetCount(static_cast<int>(sample));
}
+jint GetHistogramTotalCountForTesting(
+ JNIEnv* env,
+ const JavaParamRef<jclass>& clazz,
+ const JavaParamRef<jstring>& histogram_name) {
+ HistogramBase* histogram = StatisticsRecorder::FindHistogram(
+ android::ConvertJavaStringToUTF8(env, histogram_name));
+ if (histogram == nullptr) {
+ // No samples have been recorded for this histogram.
+ return 0;
+ }
+
+ return histogram->SnapshotSamples()->TotalCount();
+}
+
bool RegisterRecordHistogram(JNIEnv* env) {
return RegisterNativesImpl(env);
}

Powered by Google App Engine
This is Rietveld 408576698