Chromium Code Reviews| 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 sample_count, | |
| 100 std::string* output) const; | |
| 101 | |
| 102 // Write textual description of the bucket contents (relative to histogram). | |
| 103 // Output is the count in the buckets, as well as the percentage. | |
| 104 void WriteAsciiBucketValue(const Count current, const Count total, | |
|
jar (doing other things)
2013/04/04 00:45:09
nit: one arg per line in declaration and definitio
jrummell
2013/04/04 22:38:59
Done.
| |
| 105 std::string* output) const; | |
| 106 | |
| 107 // Produce actual graph (set of blank vs non blank char's) for a bucket. | |
| 108 void WriteAsciiBucketGraph(double current_size, double max_size, | |
| 109 std::string* output) const; | |
| 110 | |
| 111 // Return a string description of what goes in a given bucket. | |
| 112 std::string GetAsciiBucketRange(const Sample sample) const; | |
| 113 | |
| 93 // For constuctor calling. | 114 // For constuctor calling. |
| 94 friend class SparseHistogramTest; | 115 friend class SparseHistogramTest; |
| 95 | 116 |
| 96 // Protects access to |samples_|. | 117 // Protects access to |samples_|. |
| 97 mutable base::Lock lock_; | 118 mutable base::Lock lock_; |
| 98 | 119 |
| 99 SampleMap samples_; | 120 SampleMap samples_; |
| 100 | 121 |
| 101 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); | 122 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
| 102 }; | 123 }; |
| 103 | 124 |
| 104 } // namespace base | 125 } // namespace base |
| 105 | 126 |
| 106 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ | 127 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ |
| OLD | NEW |