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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // average over the call and recorded when a stream is removed). | 29 // average over the call and recorded when a stream is removed). |
30 // The metrics can for example be retrieved when a peer connection is closed. | 30 // The metrics can for example be retrieved when a peer connection is closed. |
31 | 31 |
32 public class Metrics { | 32 public class Metrics { |
33 private static final String TAG = "Metrics"; | 33 private static final String TAG = "Metrics"; |
34 | 34 |
35 static { | 35 static { |
36 System.loadLibrary("jingle_peerconnection_so"); | 36 System.loadLibrary("jingle_peerconnection_so"); |
37 } | 37 } |
38 public final Map<String, HistogramInfo> map = | 38 public final Map<String, HistogramInfo> map = |
39 new HashMap<String, HistogramInfo>(); // <name, HistogramInfo> | 39 new HashMap<String, HistogramInfo>(); // <name, HistogramInfo> |
40 | 40 |
41 /** | 41 /** |
42 * Class holding histogram information. | 42 * Class holding histogram information. |
43 */ | 43 */ |
44 public static class HistogramInfo { | 44 public static class HistogramInfo { |
45 public final int min; | 45 public final int min; |
46 public final int max; | 46 public final int max; |
47 public final int bucketCount; | 47 public final int bucketCount; |
48 public final Map<Integer, Integer> samples = | 48 public final Map<Integer, Integer> samples = |
49 new HashMap<Integer, Integer>(); // <value, # of events> | 49 new HashMap<Integer, Integer>(); // <value, # of events> |
50 | 50 |
51 public HistogramInfo(int min, int max, int bucketCount) { | 51 public HistogramInfo(int min, int max, int bucketCount) { |
52 this.min = min; | 52 this.min = min; |
53 this.max = max; | 53 this.max = max; |
54 this.bucketCount = bucketCount; | 54 this.bucketCount = bucketCount; |
55 } | 55 } |
56 | 56 |
57 public void addSample(int value, int numEvents) { | 57 public void addSample(int value, int numEvents) { |
58 samples.put(value, numEvents); | 58 samples.put(value, numEvents); |
59 } | 59 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 // Gets and clears native histograms. | 102 // Gets and clears native histograms. |
103 public static Metrics getAndReset() { | 103 public static Metrics getAndReset() { |
104 return nativeGetAndReset(); | 104 return nativeGetAndReset(); |
105 } | 105 } |
106 | 106 |
107 private static native void nativeEnable(); | 107 private static native void nativeEnable(); |
108 private static native Metrics nativeGetAndReset(); | 108 private static native Metrics nativeGetAndReset(); |
109 } | 109 } |
OLD | NEW |