| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 ~SparseHistogram() override; | 37 ~SparseHistogram() override; |
| 38 | 38 |
| 39 // HistogramBase implementation: | 39 // HistogramBase implementation: |
| 40 HistogramType GetHistogramType() const override; | 40 HistogramType GetHistogramType() const override; |
| 41 bool HasConstructionArguments(Sample expected_minimum, | 41 bool HasConstructionArguments(Sample expected_minimum, |
| 42 Sample expected_maximum, | 42 Sample expected_maximum, |
| 43 size_t expected_bucket_count) const override; | 43 size_t expected_bucket_count) const override; |
| 44 void Add(Sample value) override; | 44 void Add(Sample value) override; |
| 45 void AddSamples(const HistogramSamples& samples) override; | 45 void AddSamples(const HistogramSamples& samples) override; |
| 46 bool AddSamplesFromPickle(PickleIterator* iter) override; | 46 bool AddSamplesFromPickle(base::PickleIterator* iter) override; |
| 47 scoped_ptr<HistogramSamples> SnapshotSamples() const override; | 47 scoped_ptr<HistogramSamples> SnapshotSamples() const override; |
| 48 void WriteHTMLGraph(std::string* output) const override; | 48 void WriteHTMLGraph(std::string* output) const override; |
| 49 void WriteAscii(std::string* output) const override; | 49 void WriteAscii(std::string* output) const override; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 // HistogramBase implementation: | 52 // HistogramBase implementation: |
| 53 bool SerializeInfoImpl(Pickle* pickle) const override; | 53 bool SerializeInfoImpl(base::Pickle* pickle) const override; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Clients should always use FactoryGet to create SparseHistogram. | 56 // Clients should always use FactoryGet to create SparseHistogram. |
| 57 explicit SparseHistogram(const std::string& name); | 57 explicit SparseHistogram(const std::string& name); |
| 58 | 58 |
| 59 friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( | 59 friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( |
| 60 PickleIterator* iter); | 60 base::PickleIterator* iter); |
| 61 static HistogramBase* DeserializeInfoImpl(PickleIterator* iter); | 61 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); |
| 62 | 62 |
| 63 void GetParameters(DictionaryValue* params) const override; | 63 void GetParameters(DictionaryValue* params) const override; |
| 64 void GetCountAndBucketData(Count* count, | 64 void GetCountAndBucketData(Count* count, |
| 65 int64* sum, | 65 int64* sum, |
| 66 ListValue* buckets) const override; | 66 ListValue* buckets) const override; |
| 67 | 67 |
| 68 // Helpers for emitting Ascii graphic. Each method appends data to output. | 68 // Helpers for emitting Ascii graphic. Each method appends data to output. |
| 69 void WriteAsciiImpl(bool graph_it, | 69 void WriteAsciiImpl(bool graph_it, |
| 70 const std::string& newline, | 70 const std::string& newline, |
| 71 std::string* output) const; | 71 std::string* output) const; |
| 72 | 72 |
| 73 // Write a common header message describing this histogram. | 73 // Write a common header message describing this histogram. |
| 74 void WriteAsciiHeader(const Count total_count, | 74 void WriteAsciiHeader(const Count total_count, |
| 75 std::string* output) const; | 75 std::string* output) const; |
| 76 | 76 |
| 77 // For constuctor calling. | 77 // For constuctor calling. |
| 78 friend class SparseHistogramTest; | 78 friend class SparseHistogramTest; |
| 79 | 79 |
| 80 // Protects access to |samples_|. | 80 // Protects access to |samples_|. |
| 81 mutable base::Lock lock_; | 81 mutable base::Lock lock_; |
| 82 | 82 |
| 83 SampleMap samples_; | 83 SampleMap samples_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); | 85 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace base | 88 } // namespace base |
| 89 | 89 |
| 90 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ | 90 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ |
| OLD | NEW |