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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 explicit SparseHistogram(const std::string& name); | 83 explicit SparseHistogram(const std::string& name); |
84 | 84 |
85 friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( | 85 friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( |
86 PickleIterator* iter); | 86 PickleIterator* iter); |
87 static HistogramBase* DeserializeInfoImpl(PickleIterator* iter); | 87 static HistogramBase* DeserializeInfoImpl(PickleIterator* iter); |
88 | 88 |
89 virtual void GetParameters(DictionaryValue* params) const OVERRIDE; | 89 virtual void GetParameters(DictionaryValue* params) const OVERRIDE; |
90 virtual void GetCountAndBucketData(Count* count, | 90 virtual void GetCountAndBucketData(Count* count, |
91 ListValue* buckets) const OVERRIDE; | 91 ListValue* buckets) const OVERRIDE; |
92 | 92 |
| 93 // Helpers for emitting Ascii graphic. Each method appends data to output. |
| 94 void WriteAsciiImpl(bool graph_it, |
| 95 const std::string& newline, |
| 96 std::string* output) const; |
| 97 |
| 98 // Write a common header message describing this histogram. |
| 99 void WriteAsciiHeader(const Count total_count, |
| 100 std::string* output) const; |
| 101 |
93 // For constuctor calling. | 102 // For constuctor calling. |
94 friend class SparseHistogramTest; | 103 friend class SparseHistogramTest; |
95 | 104 |
96 // Protects access to |samples_|. | 105 // Protects access to |samples_|. |
97 mutable base::Lock lock_; | 106 mutable base::Lock lock_; |
98 | 107 |
99 SampleMap samples_; | 108 SampleMap samples_; |
100 | 109 |
101 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); | 110 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
102 }; | 111 }; |
103 | 112 |
104 } // namespace base | 113 } // namespace base |
105 | 114 |
106 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ | 115 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ |
OLD | NEW |