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

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: added GN changes 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
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(uint64 id) : HistogramSamples(id) {}
15 15
16 SampleMap::~SampleMap() {} 16 SampleMap::~SampleMap() {}
17 17
18 void SampleMap::Accumulate(Sample value, Count count) { 18 void SampleMap::Accumulate(Sample value, Count count) {
19 sample_counts_[value] += count; 19 sample_counts_[value] += count;
20 IncreaseSum(count * value); 20 IncreaseSum(count * value);
21 IncreaseRedundantCount(count); 21 IncreaseRedundantCount(count);
22 } 22 }
23 23
24 Count SampleMap::GetCount(Sample value) const { 24 Count SampleMap::GetCount(Sample value) const {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 *count = iter_->second; 83 *count = iter_->second;
84 } 84 }
85 85
86 void SampleMapIterator::SkipEmptyBuckets() { 86 void SampleMapIterator::SkipEmptyBuckets() {
87 while (!Done() && iter_->second == 0) { 87 while (!Done() && iter_->second == 0) {
88 ++iter_; 88 ++iter_;
89 } 89 }
90 } 90 }
91 91
92 } // namespace base 92 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698