| 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 12 matching lines...) Expand all Loading... |
| 23 virtual ~SampleMap(); | 23 virtual ~SampleMap(); |
| 24 | 24 |
| 25 // HistogramSamples implementation: | 25 // HistogramSamples implementation: |
| 26 virtual void Accumulate(HistogramBase::Sample value, | 26 virtual void Accumulate(HistogramBase::Sample value, |
| 27 HistogramBase::Count count) OVERRIDE; | 27 HistogramBase::Count count) OVERRIDE; |
| 28 virtual HistogramBase::Count GetCount( | 28 virtual HistogramBase::Count GetCount( |
| 29 HistogramBase::Sample value) const OVERRIDE; | 29 HistogramBase::Sample value) const OVERRIDE; |
| 30 virtual HistogramBase::Count TotalCount() const OVERRIDE; | 30 virtual HistogramBase::Count TotalCount() const OVERRIDE; |
| 31 virtual scoped_ptr<SampleCountIterator> Iterator() const OVERRIDE; | 31 virtual scoped_ptr<SampleCountIterator> Iterator() const OVERRIDE; |
| 32 | 32 |
| 33 void ResetRedundantCount(HistogramBase::Count count); | |
| 34 | |
| 35 protected: | 33 protected: |
| 36 virtual bool AddSubtractImpl( | 34 virtual bool AddSubtractImpl( |
| 37 SampleCountIterator* iter, | 35 SampleCountIterator* iter, |
| 38 HistogramSamples::Operator op) OVERRIDE; // |op| is ADD or SUBTRACT. | 36 HistogramSamples::Operator op) OVERRIDE; // |op| is ADD or SUBTRACT. |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; | 39 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; |
| 42 | 40 |
| 43 DISALLOW_COPY_AND_ASSIGN(SampleMap); | 41 DISALLOW_COPY_AND_ASSIGN(SampleMap); |
| 44 }; | 42 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 HistogramBase::Sample* max, | 56 HistogramBase::Sample* max, |
| 59 HistogramBase::Count* count) const OVERRIDE; | 57 HistogramBase::Count* count) const OVERRIDE; |
| 60 private: | 58 private: |
| 61 SampleToCountMap::const_iterator iter_; | 59 SampleToCountMap::const_iterator iter_; |
| 62 const SampleToCountMap::const_iterator end_; | 60 const SampleToCountMap::const_iterator end_; |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 } // namespace base | 63 } // namespace base |
| 66 | 64 |
| 67 #endif // BASE_METRICS_SAMPLE_MAP_H_ | 65 #endif // BASE_METRICS_SAMPLE_MAP_H_ |
| OLD | NEW |