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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 HistogramType GetHistogramType() const override; | 74 HistogramType GetHistogramType() const override; |
75 bool HasConstructionArguments(Sample expected_minimum, | 75 bool HasConstructionArguments(Sample expected_minimum, |
76 Sample expected_maximum, | 76 Sample expected_maximum, |
77 uint32_t expected_bucket_count) const override; | 77 uint32_t expected_bucket_count) const override; |
78 void Add(Sample value) override; | 78 void Add(Sample value) override; |
79 void AddCount(Sample value, int count) override; | 79 void AddCount(Sample value, int count) override; |
80 void AddSamples(const HistogramSamples& samples) override; | 80 void AddSamples(const HistogramSamples& samples) override; |
81 bool AddSamplesFromPickle(base::PickleIterator* iter) override; | 81 bool AddSamplesFromPickle(base::PickleIterator* iter) override; |
82 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; | 82 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; |
83 std::unique_ptr<HistogramSamples> SnapshotDelta() override; | 83 std::unique_ptr<HistogramSamples> SnapshotDelta() override; |
| 84 std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const override; |
84 void WriteHTMLGraph(std::string* output) const override; | 85 void WriteHTMLGraph(std::string* output) const override; |
85 void WriteAscii(std::string* output) const override; | 86 void WriteAscii(std::string* output) const override; |
86 | 87 |
87 protected: | 88 protected: |
88 // HistogramBase implementation: | 89 // HistogramBase implementation: |
89 bool SerializeInfoImpl(base::Pickle* pickle) const override; | 90 bool SerializeInfoImpl(base::Pickle* pickle) const override; |
90 | 91 |
91 private: | 92 private: |
92 // Clients should always use FactoryGet to create SparseHistogram. | 93 // Clients should always use FactoryGet to create SparseHistogram. |
93 explicit SparseHistogram(const std::string& name); | 94 explicit SparseHistogram(const std::string& name); |
(...skipping 20 matching lines...) Expand all Loading... |
114 // Write a common header message describing this histogram. | 115 // Write a common header message describing this histogram. |
115 void WriteAsciiHeader(const Count total_count, | 116 void WriteAsciiHeader(const Count total_count, |
116 std::string* output) const; | 117 std::string* output) const; |
117 | 118 |
118 // For constuctor calling. | 119 // For constuctor calling. |
119 friend class SparseHistogramTest; | 120 friend class SparseHistogramTest; |
120 | 121 |
121 // Protects access to |samples_|. | 122 // Protects access to |samples_|. |
122 mutable base::Lock lock_; | 123 mutable base::Lock lock_; |
123 | 124 |
| 125 // Flag to indicate if PrepareFinalDelta has been previously called. |
| 126 mutable bool final_delta_created_ = false; |
| 127 |
124 std::unique_ptr<HistogramSamples> samples_; | 128 std::unique_ptr<HistogramSamples> samples_; |
125 std::unique_ptr<HistogramSamples> logged_samples_; | 129 std::unique_ptr<HistogramSamples> logged_samples_; |
126 | 130 |
127 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); | 131 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace base | 134 } // namespace base |
131 | 135 |
132 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ | 136 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ |
OLD | NEW |