OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include <map> | |
12 #include <memory> | |
13 | |
14 #include "webrtc/api/android/jni/classreferenceholder.h" | |
15 #include "webrtc/api/android/jni/jni_helpers.h" | |
16 #include "webrtc/api/android/jni/native_handle_impl.h" | |
17 #include "webrtc/system_wrappers/include/metrics.h" | |
18 | |
19 // Enables collection of native histograms and creating them. | |
20 namespace webrtc_jni { | |
21 | |
22 JOW(jlong, Histogram_nativeCreateCounts) | |
23 (JNIEnv* jni, jclass, jstring j_name, jint min, jint max, jint buckets) { | |
24 std::string name = JavaToStdString(jni, j_name); | |
25 return jlongFromPointer( | |
26 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); | |
27 } | |
28 | |
29 JOW(jlong, Histogram_nativeCreateEnumeration) | |
30 (JNIEnv* jni, jclass, jstring j_name, jint max) { | |
31 std::string name = JavaToStdString(jni, j_name); | |
32 return jlongFromPointer( | |
33 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); | |
34 } | |
35 | |
36 JOW(void, Histogram_nativeAddSample) | |
37 (JNIEnv* jni, jclass, jlong histogram, jint sample) { | |
38 if (histogram) { | |
39 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), | |
40 sample); | |
41 } | |
42 } | |
43 | |
44 } // namespace webrtc_jni | |
OLD | NEW |