OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 28 matching lines...) Expand all Loading... | |
39 class FakeMetricsObserver : public MetricsObserverInterface { | 39 class FakeMetricsObserver : public MetricsObserverInterface { |
40 public: | 40 public: |
41 FakeMetricsObserver(); | 41 FakeMetricsObserver(); |
42 void Reset(); | 42 void Reset(); |
43 | 43 |
44 void IncrementEnumCounter(PeerConnectionEnumCounterType, | 44 void IncrementEnumCounter(PeerConnectionEnumCounterType, |
45 int counter, | 45 int counter, |
46 int counter_max) override; | 46 int counter_max) override; |
47 void AddHistogramSample(PeerConnectionMetricsName type, | 47 void AddHistogramSample(PeerConnectionMetricsName type, |
48 int value) override; | 48 int value) override; |
49 void AddHistogramSample(PeerConnectionMetricsName type, | |
50 const std::string& value) override; | |
51 | 49 |
52 // Accessors to be used by the tests. | 50 // Accessors to be used by the tests. |
53 int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; | 51 int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; |
54 int GetIntHistogramSample(PeerConnectionMetricsName type) const; | 52 int GetHistogramSample(PeerConnectionMetricsName type) const; |
55 const std::string& GetStringHistogramSample( | |
56 PeerConnectionMetricsName type) const; | |
57 | 53 |
58 protected: | 54 protected: |
59 ~FakeMetricsObserver() {} | 55 ~FakeMetricsObserver() {} |
60 | 56 |
61 private: | 57 private: |
62 rtc::ThreadChecker thread_checker_; | 58 rtc::ThreadChecker thread_checker_; |
63 // This is a 2 dimension array. The first index is the enum counter type. The | 59 // The outer array is the type of the enum counter. The inner map is mapping |
64 // 2nd index is the counter of that particular enum counter type. | 60 // from a particular counter to its accumulated count. The reason it is a map |
65 std::vector<std::vector<int>> counters_; | 61 // is to work with sparse enum type which might span a large number space. |
juberti
2015/09/24 21:37:32
An example of how this works would also be helpful
guoweis_webrtc
2015/09/25 18:30:31
Done.
| |
66 int int_histogram_samples_[kPeerConnectionMetricsName_Max]; | 62 std::vector<std::map<int, int>> counters_; |
67 std::string string_histogram_samples_[kPeerConnectionMetricsName_Max]; | 63 int histogram_samples_[kPeerConnectionMetricsName_Max]; |
68 }; | 64 }; |
69 | 65 |
70 } // namespace webrtc | 66 } // namespace webrtc |
71 | 67 |
72 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ | 68 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |
OLD | NEW |