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 #include "base/metrics/sparse_histogram.h" | 5 #include "base/metrics/sparse_histogram.h" |
6 | 6 |
7 #include "base/metrics/sample_map.h" | 7 #include "base/metrics/sample_map.h" |
8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 DCHECK_EQ(SPARSE_HISTOGRAM, histogram->GetHistogramType()); | 32 DCHECK_EQ(SPARSE_HISTOGRAM, histogram->GetHistogramType()); |
33 return histogram; | 33 return histogram; |
34 } | 34 } |
35 | 35 |
36 SparseHistogram::~SparseHistogram() {} | 36 SparseHistogram::~SparseHistogram() {} |
37 | 37 |
38 HistogramType SparseHistogram::GetHistogramType() const { | 38 HistogramType SparseHistogram::GetHistogramType() const { |
39 return SPARSE_HISTOGRAM; | 39 return SPARSE_HISTOGRAM; |
40 } | 40 } |
41 | 41 |
42 bool SparseHistogram::HasConstructionArguments(Sample minimum, | 42 bool SparseHistogram::HasConstructionArguments( |
43 Sample maximum, | 43 Sample expected_minimum, |
44 size_t bucket_count) const { | 44 Sample expected_maximum, |
| 45 size_t expected_bucket_count) const { |
45 // SparseHistogram never has min/max/bucket_count limit. | 46 // SparseHistogram never has min/max/bucket_count limit. |
46 return false; | 47 return false; |
47 } | 48 } |
48 | 49 |
49 void SparseHistogram::Add(Sample value) { | 50 void SparseHistogram::Add(Sample value) { |
50 base::AutoLock auto_lock(lock_); | 51 base::AutoLock auto_lock(lock_); |
51 samples_.Accumulate(value, 1); | 52 samples_.Accumulate(value, 1); |
52 } | 53 } |
53 | 54 |
54 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const { | 55 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 std::string* output) const { | 170 std::string* output) const { |
170 StringAppendF(output, | 171 StringAppendF(output, |
171 "Histogram: %s recorded %d samples", | 172 "Histogram: %s recorded %d samples", |
172 histogram_name().c_str(), | 173 histogram_name().c_str(), |
173 total_count); | 174 total_count); |
174 if (flags() & ~kHexRangePrintingFlag) | 175 if (flags() & ~kHexRangePrintingFlag) |
175 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); | 176 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); |
176 } | 177 } |
177 | 178 |
178 } // namespace base | 179 } // namespace base |
OLD | NEW |