Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: base/metrics/sparse_histogram.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 39
40 bool SparseHistogram::HasConstructionArguments( 40 bool SparseHistogram::HasConstructionArguments(
41 Sample expected_minimum, 41 Sample expected_minimum,
42 Sample expected_maximum, 42 Sample expected_maximum,
43 size_t expected_bucket_count) const { 43 size_t expected_bucket_count) const {
44 // SparseHistogram never has min/max/bucket_count limit. 44 // SparseHistogram never has min/max/bucket_count limit.
45 return false; 45 return false;
46 } 46 }
47 47
48 void SparseHistogram::Add(Sample value) { 48 void SparseHistogram::Add(Sample value) {
49 base::AutoLock auto_lock(lock_); 49 {
50 samples_.Accumulate(value, 1); 50 base::AutoLock auto_lock(lock_);
51 samples_.Accumulate(value, 1);
52 }
53
54 FindAndRunCallback(value);
51 } 55 }
52 56
53 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const { 57 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const {
54 scoped_ptr<SampleMap> snapshot(new SampleMap()); 58 scoped_ptr<SampleMap> snapshot(new SampleMap());
55 59
56 base::AutoLock auto_lock(lock_); 60 base::AutoLock auto_lock(lock_);
57 snapshot->Add(samples_); 61 snapshot->Add(samples_);
58 return snapshot.Pass(); 62 return snapshot.Pass();
59 } 63 }
60 64
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::string* output) const { 170 std::string* output) const {
167 StringAppendF(output, 171 StringAppendF(output,
168 "Histogram: %s recorded %d samples", 172 "Histogram: %s recorded %d samples",
169 histogram_name().c_str(), 173 histogram_name().c_str(),
170 total_count); 174 total_count);
171 if (flags() & ~kHexRangePrintingFlag) 175 if (flags() & ~kHexRangePrintingFlag)
172 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); 176 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag);
173 } 177 }
174 178
175 } // namespace base 179 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698