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

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

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: addressed review comments by Alexei Created 5 years 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/sample_map.h ('k') | base/metrics/sample_map_unittest.cc » ('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/sample_map.h" 5 #include "base/metrics/sample_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace base { 9 namespace base {
10 10
11 typedef HistogramBase::Count Count; 11 typedef HistogramBase::Count Count;
12 typedef HistogramBase::Sample Sample; 12 typedef HistogramBase::Sample Sample;
13 13
14 SampleMap::SampleMap() {} 14 SampleMap::SampleMap() : SampleMap(0) {}
15
16 SampleMap::SampleMap(uint64_t id) : HistogramSamples(id) {}
15 17
16 SampleMap::~SampleMap() {} 18 SampleMap::~SampleMap() {}
17 19
18 void SampleMap::Accumulate(Sample value, Count count) { 20 void SampleMap::Accumulate(Sample value, Count count) {
19 sample_counts_[value] += count; 21 sample_counts_[value] += count;
20 IncreaseSum(count * value); 22 IncreaseSum(count * value);
21 IncreaseRedundantCount(count); 23 IncreaseRedundantCount(count);
22 } 24 }
23 25
24 Count SampleMap::GetCount(Sample value) const { 26 Count SampleMap::GetCount(Sample value) const {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 *count = iter_->second; 85 *count = iter_->second;
84 } 86 }
85 87
86 void SampleMapIterator::SkipEmptyBuckets() { 88 void SampleMapIterator::SkipEmptyBuckets() {
87 while (!Done() && iter_->second == 0) { 89 while (!Done() && iter_->second == 0) {
88 ++iter_; 90 ++iter_;
89 } 91 }
90 } 92 }
91 93
92 } // namespace base 94 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/sample_map.h ('k') | base/metrics/sample_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698