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