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 #ifndef BASE_METRICS_SPARSE_HISTOGRAM_H_ | 5 #ifndef BASE_METRICS_SPARSE_HISTOGRAM_H_ |
6 #define BASE_METRICS_SPARSE_HISTOGRAM_H_ | 6 #define BASE_METRICS_SPARSE_HISTOGRAM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual bool HasConstructionArguments(Sample minimum, | 32 virtual bool HasConstructionArguments(Sample minimum, |
33 Sample maximum, | 33 Sample maximum, |
34 size_t bucket_count) const OVERRIDE; | 34 size_t bucket_count) const OVERRIDE; |
35 virtual void Add(Sample value) OVERRIDE; | 35 virtual void Add(Sample value) OVERRIDE; |
36 virtual void WriteHTMLGraph(std::string* output) const OVERRIDE; | 36 virtual void WriteHTMLGraph(std::string* output) const OVERRIDE; |
37 virtual void WriteAscii(std::string* output) const OVERRIDE; | 37 virtual void WriteAscii(std::string* output) const OVERRIDE; |
38 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const OVERRIDE; | 38 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const OVERRIDE; |
39 | 39 |
40 private: | 40 private: |
41 // Clients should always use FactoryGet to create SparseHistogram. | 41 // Clients should always use FactoryGet to create SparseHistogram. |
42 SparseHistogram(const std::string& name); | 42 explicit SparseHistogram(const std::string& name); |
43 | 43 |
44 virtual void GetParameters(DictionaryValue* params) const OVERRIDE; | 44 virtual void GetParameters(DictionaryValue* params) const OVERRIDE; |
45 virtual void GetCountAndBucketData(Count* count, | 45 virtual void GetCountAndBucketData(Count* count, |
46 ListValue* buckets) const OVERRIDE; | 46 ListValue* buckets) const OVERRIDE; |
47 | 47 |
48 friend class SparseHistogramTest; // For constuctor calling. | 48 friend class SparseHistogramTest; // For constuctor calling. |
49 | 49 |
50 // Protects access to |sample_counts_| and |redundant_count_|. | 50 // Protects access to |sample_counts_| and |redundant_count_|. |
51 mutable base::Lock lock_; | 51 mutable base::Lock lock_; |
52 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; | 52 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; |
53 HistogramBase::Count redundant_count_; | 53 HistogramBase::Count redundant_count_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); | 55 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
56 }; | 56 }; |
57 | 57 |
58 } // namespace base | 58 } // namespace base |
59 | 59 |
60 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ | 60 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ |
OLD | NEW |