| 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/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 Loading... |
| 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 |
| OLD | NEW |