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

Unified Diff: webrtc/api/android/jni/androidmetrics_jni.cc

Issue 2320473002: Make UMA stats creation available in the Java interface. (Closed)
Patch Set: Also update the example. Created 4 years, 3 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: webrtc/api/android/jni/androidmetrics_jni.cc
diff --git a/webrtc/api/android/jni/androidmetrics_jni.cc b/webrtc/api/android/jni/androidmetrics_jni.cc
index 6e658c886bf24d257aa4f5ef9704a537b9e6210f..833066a66f915ca06da2027dfddb79c8113fc613 100644
--- a/webrtc/api/android/jni/androidmetrics_jni.cc
+++ b/webrtc/api/android/jni/androidmetrics_jni.cc
@@ -14,10 +14,12 @@
#include "webrtc/api/android/jni/classreferenceholder.h"
#include "webrtc/api/android/jni/jni_helpers.h"
#include "webrtc/api/android/jni/native_handle_impl.h"
+#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/system_wrappers/include/metrics_default.h"
-// Enables collection of native histograms.
+// Enables collection of native histograms and creating them.
namespace webrtc_jni {
+
JOW(void, Metrics_nativeEnable)(JNIEnv* jni, jclass) {
webrtc::metrics::Enable();
}
@@ -56,4 +58,18 @@ JOW(jobject, Metrics_nativeGetAndReset)(JNIEnv* jni, jclass) {
CHECK_EXCEPTION(jni);
return j_metrics;
}
+
+JOW(jlong, Metrics_00024Histogram_nativeCreateCounts)
+(JNIEnv* jni, jclass, jstring j_name, jint min, jint max, jint buckets) {
+ std::string name = JavaToStdString(jni, j_name);
+ return jlongFromPointer(
+ webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets));
+}
+
+JOW(void, Metrics_00024Histogram_nativeAddSample)
+(JNIEnv* jni, jclass, jlong histogram, jint sample) {
+ HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram),
+ sample);
+}
+
} // namespace webrtc_jni
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/Metrics.java ('k') | webrtc/system_wrappers/include/metrics_default.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698