| 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/sdk/android/src/jni/classreferenceholder.h" | 14 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" |
| 15 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 15 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
| 16 #include "webrtc/system_wrappers/include/metrics.h" | 16 #include "webrtc/system_wrappers/include/metrics.h" |
| 17 | 17 |
| 18 // Enables collection of native histograms and creating them. | 18 // Enables collection of native histograms and creating them. |
| 19 namespace webrtc_jni { | 19 namespace webrtc_jni { |
| 20 | 20 |
| 21 JOW(jlong, Histogram_nativeCreateCounts) | 21 JNI_FUNCTION_DECLARATION(jlong, |
| 22 (JNIEnv* jni, jclass, jstring j_name, jint min, jint max, jint buckets) { | 22 Histogram_nativeCreateCounts, |
| 23 JNIEnv* jni, |
| 24 jclass, |
| 25 jstring j_name, |
| 26 jint min, |
| 27 jint max, |
| 28 jint buckets) { |
| 23 std::string name = JavaToStdString(jni, j_name); | 29 std::string name = JavaToStdString(jni, j_name); |
| 24 return jlongFromPointer( | 30 return jlongFromPointer( |
| 25 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); | 31 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); |
| 26 } | 32 } |
| 27 | 33 |
| 28 JOW(jlong, Histogram_nativeCreateEnumeration) | 34 JNI_FUNCTION_DECLARATION(jlong, |
| 29 (JNIEnv* jni, jclass, jstring j_name, jint max) { | 35 Histogram_nativeCreateEnumeration, |
| 36 JNIEnv* jni, |
| 37 jclass, |
| 38 jstring j_name, |
| 39 jint max) { |
| 30 std::string name = JavaToStdString(jni, j_name); | 40 std::string name = JavaToStdString(jni, j_name); |
| 31 return jlongFromPointer( | 41 return jlongFromPointer( |
| 32 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); | 42 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); |
| 33 } | 43 } |
| 34 | 44 |
| 35 JOW(void, Histogram_nativeAddSample) | 45 JNI_FUNCTION_DECLARATION(void, |
| 36 (JNIEnv* jni, jclass, jlong histogram, jint sample) { | 46 Histogram_nativeAddSample, |
| 47 JNIEnv* jni, |
| 48 jclass, |
| 49 jlong histogram, |
| 50 jint sample) { |
| 37 if (histogram) { | 51 if (histogram) { |
| 38 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), | 52 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), |
| 39 sample); | 53 sample); |
| 40 } | 54 } |
| 41 } | 55 } |
| 42 | 56 |
| 43 } // namespace webrtc_jni | 57 } // namespace webrtc_jni |
| OLD | NEW |