| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Histogram is an object that aggregates statistics, and can summarize them in | 5 // Histogram is an object that aggregates statistics, and can summarize them in |
| 6 // various forms, including ASCII graphical, HTML, and numerically (as a | 6 // various forms, including ASCII graphical, HTML, and numerically (as a |
| 7 // vector of numbers corresponding to each of the aggregating buckets). | 7 // vector of numbers corresponding to each of the aggregating buckets). |
| 8 // See header file for details and examples. | 8 // See header file for details and examples. |
| 9 | 9 |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } | 518 } |
| 519 | 519 |
| 520 // Update histogram data with new sample. | 520 // Update histogram data with new sample. |
| 521 void Histogram::Accumulate(Sample value, Count count, size_t index) { | 521 void Histogram::Accumulate(Sample value, Count count, size_t index) { |
| 522 // Note locking not done in this version!!! | 522 // Note locking not done in this version!!! |
| 523 sample_.Accumulate(value, count, index); | 523 sample_.Accumulate(value, count, index); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void Histogram::SetBucketRange(size_t i, Sample value) { | 526 void Histogram::SetBucketRange(size_t i, Sample value) { |
| 527 DCHECK_GT(bucket_count_, i); | 527 DCHECK_GT(bucket_count_, i); |
| 528 DCHECK_GE(value, 0); |
| 528 ranges_[i] = value; | 529 ranges_[i] = value; |
| 529 } | 530 } |
| 530 | 531 |
| 531 bool Histogram::ValidateBucketRanges() const { | 532 bool Histogram::ValidateBucketRanges() const { |
| 532 // Standard assertions that all bucket ranges should satisfy. | 533 // Standard assertions that all bucket ranges should satisfy. |
| 533 DCHECK_EQ(bucket_count_ + 1, ranges_.size()); | 534 DCHECK_EQ(bucket_count_ + 1, ranges_.size()); |
| 534 DCHECK_EQ(0, ranges_[0]); | 535 DCHECK_EQ(0, ranges_[0]); |
| 535 DCHECK_EQ(declared_min(), ranges_[1]); | 536 DCHECK_EQ(declared_min(), ranges_[1]); |
| 536 DCHECK_EQ(declared_max(), ranges_[bucket_count_ - 1]); | 537 DCHECK_EQ(declared_max(), ranges_[bucket_count_ - 1]); |
| 537 DCHECK_EQ(kSampleType_MAX, ranges_[bucket_count_]); | 538 DCHECK_EQ(kSampleType_MAX, ranges_[bucket_count_]); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 } | 1143 } |
| 1143 | 1144 |
| 1144 // static | 1145 // static |
| 1145 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 1146 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
| 1146 // static | 1147 // static |
| 1147 base::Lock* StatisticsRecorder::lock_ = NULL; | 1148 base::Lock* StatisticsRecorder::lock_ = NULL; |
| 1148 // static | 1149 // static |
| 1149 bool StatisticsRecorder::dump_on_exit_ = false; | 1150 bool StatisticsRecorder::dump_on_exit_ = false; |
| 1150 | 1151 |
| 1151 } // namespace base | 1152 } // namespace base |
| OLD | NEW |