| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 StatsRate::Add(-value); | 633 StatsRate::Add(-value); |
| 634 size_t index = BucketIndex(value); | 634 size_t index = BucketIndex(value); |
| 635 Accumulate(value, -1, index); | 635 Accumulate(value, -1, index); |
| 636 } | 636 } |
| 637 | 637 |
| 638 void ThreadSafeHistogram::Accumulate(Sample value, Count count, size_t index) { | 638 void ThreadSafeHistogram::Accumulate(Sample value, Count count, size_t index) { |
| 639 AutoLock lock(lock_); | 639 AutoLock lock(lock_); |
| 640 Histogram::Accumulate(value, count, index); | 640 Histogram::Accumulate(value, count, index); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void ThreadSafeHistogram::SnapshotSample(SampleSet* sample) { | 643 void ThreadSafeHistogram::SnapshotSample(SampleSet* sample) const { |
| 644 AutoLock lock(lock_); | 644 AutoLock lock(lock_); |
| 645 Histogram::SnapshotSample(sample); | 645 Histogram::SnapshotSample(sample); |
| 646 }; | 646 }; |
| 647 | 647 |
| 648 | 648 |
| 649 //------------------------------------------------------------------------------ | 649 //------------------------------------------------------------------------------ |
| 650 // The next section handles global (central) support for all histograms, as well | 650 // The next section handles global (central) support for all histograms, as well |
| 651 // as startup/teardown of this service. | 651 // as startup/teardown of this service. |
| 652 //------------------------------------------------------------------------------ | 652 //------------------------------------------------------------------------------ |
| 653 | 653 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 snapshot->push_back(it->second); | 790 snapshot->push_back(it->second); |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 | 793 |
| 794 // static | 794 // static |
| 795 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 795 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
| 796 // static | 796 // static |
| 797 Lock* StatisticsRecorder::lock_ = NULL; | 797 Lock* StatisticsRecorder::lock_ = NULL; |
| 798 // static | 798 // static |
| 799 bool StatisticsRecorder::dump_on_exit_ = false; | 799 bool StatisticsRecorder::dump_on_exit_ = false; |
| OLD | NEW |