| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/histogram_base.h" | 15 #include "base/metrics/histogram_base.h" |
| 16 #include "base/metrics/histogram_samples.h" | 16 #include "base/metrics/histogram_samples.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 | 19 |
| 20 class BASE_EXPORT SampleMap : public HistogramSamples { | 20 class BASE_EXPORT SampleMap : public HistogramSamples { |
| 21 public: | 21 public: |
| 22 SampleMap(); | 22 SampleMap(); |
| 23 explicit SampleMap(uint64_t id); |
| 23 ~SampleMap() override; | 24 ~SampleMap() override; |
| 24 | 25 |
| 25 // HistogramSamples implementation: | 26 // HistogramSamples implementation: |
| 26 void Accumulate(HistogramBase::Sample value, | 27 void Accumulate(HistogramBase::Sample value, |
| 27 HistogramBase::Count count) override; | 28 HistogramBase::Count count) override; |
| 28 HistogramBase::Count GetCount(HistogramBase::Sample value) const override; | 29 HistogramBase::Count GetCount(HistogramBase::Sample value) const override; |
| 29 HistogramBase::Count TotalCount() const override; | 30 HistogramBase::Count TotalCount() const override; |
| 30 scoped_ptr<SampleCountIterator> Iterator() const override; | 31 scoped_ptr<SampleCountIterator> Iterator() const override; |
| 31 | 32 |
| 32 protected: | 33 protected: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 private: | 59 private: |
| 59 void SkipEmptyBuckets(); | 60 void SkipEmptyBuckets(); |
| 60 | 61 |
| 61 SampleToCountMap::const_iterator iter_; | 62 SampleToCountMap::const_iterator iter_; |
| 62 const SampleToCountMap::const_iterator end_; | 63 const SampleToCountMap::const_iterator end_; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace base | 66 } // namespace base |
| 66 | 67 |
| 67 #endif // BASE_METRICS_SAMPLE_MAP_H_ | 68 #endif // BASE_METRICS_SAMPLE_MAP_H_ |
| OLD | NEW |