OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // SampleMap implements HistogramSamples interface. It is used by the | 5 // SampleMap implements HistogramSamples interface. It is used by the |
6 // SparseHistogram class to store samples. | 6 // SparseHistogram class to store samples. |
7 | 7 |
8 #ifndef BASE_METRICS_SAMPLE_MAP_H_ | 8 #ifndef BASE_METRICS_SAMPLE_MAP_H_ |
9 #define BASE_METRICS_SAMPLE_MAP_H_ | 9 #define BASE_METRICS_SAMPLE_MAP_H_ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 SampleMap(); | 22 SampleMap(); |
23 explicit SampleMap(uint64 id); | 23 explicit SampleMap(uint64 id); |
24 ~SampleMap() override; | 24 ~SampleMap() override; |
25 | 25 |
26 // HistogramSamples implementation: | 26 // HistogramSamples implementation: |
27 void Accumulate(HistogramBase::Sample value, | 27 void Accumulate(HistogramBase::Sample value, |
28 HistogramBase::Count count) override; | 28 HistogramBase::Count count) override; |
29 HistogramBase::Count GetCount(HistogramBase::Sample value) const override; | 29 HistogramBase::Count GetCount(HistogramBase::Sample value) const override; |
30 HistogramBase::Count TotalCount() const override; | 30 HistogramBase::Count TotalCount() const override; |
| 31 void Negate() override; |
31 scoped_ptr<SampleCountIterator> Iterator() const override; | 32 scoped_ptr<SampleCountIterator> Iterator() const override; |
32 | 33 |
33 protected: | 34 protected: |
34 bool AddSubtractImpl( | 35 bool AddSubtractImpl( |
35 SampleCountIterator* iter, | 36 SampleCountIterator* iter, |
36 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. | 37 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. |
37 | 38 |
38 private: | 39 private: |
39 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; | 40 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; |
40 | 41 |
(...skipping 18 matching lines...) Expand all Loading... |
59 private: | 60 private: |
60 void SkipEmptyBuckets(); | 61 void SkipEmptyBuckets(); |
61 | 62 |
62 SampleToCountMap::const_iterator iter_; | 63 SampleToCountMap::const_iterator iter_; |
63 const SampleToCountMap::const_iterator end_; | 64 const SampleToCountMap::const_iterator end_; |
64 }; | 65 }; |
65 | 66 |
66 } // namespace base | 67 } // namespace base |
67 | 68 |
68 #endif // BASE_METRICS_SAMPLE_MAP_H_ | 69 #endif // BASE_METRICS_SAMPLE_MAP_H_ |
OLD | NEW |