| 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 { |
| 20 namespace jni { |
| 20 | 21 |
| 21 JNI_FUNCTION_DECLARATION(jlong, | 22 JNI_FUNCTION_DECLARATION(jlong, |
| 22 Histogram_nativeCreateCounts, | 23 Histogram_nativeCreateCounts, |
| 23 JNIEnv* jni, | 24 JNIEnv* jni, |
| 24 jclass, | 25 jclass, |
| 25 jstring j_name, | 26 jstring j_name, |
| 26 jint min, | 27 jint min, |
| 27 jint max, | 28 jint max, |
| 28 jint buckets) { | 29 jint buckets) { |
| 29 std::string name = JavaToStdString(jni, j_name); | 30 std::string name = JavaToStdString(jni, j_name); |
| 30 return jlongFromPointer( | 31 return jlongFromPointer( |
| 31 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); | 32 metrics::HistogramFactoryGetCounts(name, min, max, buckets)); |
| 32 } | 33 } |
| 33 | 34 |
| 34 JNI_FUNCTION_DECLARATION(jlong, | 35 JNI_FUNCTION_DECLARATION(jlong, |
| 35 Histogram_nativeCreateEnumeration, | 36 Histogram_nativeCreateEnumeration, |
| 36 JNIEnv* jni, | 37 JNIEnv* jni, |
| 37 jclass, | 38 jclass, |
| 38 jstring j_name, | 39 jstring j_name, |
| 39 jint max) { | 40 jint max) { |
| 40 std::string name = JavaToStdString(jni, j_name); | 41 std::string name = JavaToStdString(jni, j_name); |
| 41 return jlongFromPointer( | 42 return jlongFromPointer(metrics::HistogramFactoryGetEnumeration(name, max)); |
| 42 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); | |
| 43 } | 43 } |
| 44 | 44 |
| 45 JNI_FUNCTION_DECLARATION(void, | 45 JNI_FUNCTION_DECLARATION(void, |
| 46 Histogram_nativeAddSample, | 46 Histogram_nativeAddSample, |
| 47 JNIEnv* jni, | 47 JNIEnv* jni, |
| 48 jclass, | 48 jclass, |
| 49 jlong histogram, | 49 jlong histogram, |
| 50 jint sample) { | 50 jint sample) { |
| 51 if (histogram) { | 51 if (histogram) { |
| 52 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), | 52 HistogramAdd(reinterpret_cast<metrics::Histogram*>(histogram), sample); |
| 53 sample); | |
| 54 } | 53 } |
| 55 } | 54 } |
| 56 | 55 |
| 57 } // namespace webrtc_jni | 56 } // namespace jni |
| 57 } // namespace webrtc |
| OLD | NEW |