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 // 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 protected: | 746 protected: |
747 BucketRanges* CreateRanges() override { | 747 BucketRanges* CreateRanges() override { |
748 BucketRanges* ranges = new BucketRanges(bucket_count_ + 1); | 748 BucketRanges* ranges = new BucketRanges(bucket_count_ + 1); |
749 LinearHistogram::InitializeBucketRanges(minimum_, maximum_, ranges); | 749 LinearHistogram::InitializeBucketRanges(minimum_, maximum_, ranges); |
750 return ranges; | 750 return ranges; |
751 } | 751 } |
752 | 752 |
753 std::unique_ptr<HistogramBase> HeapAlloc( | 753 std::unique_ptr<HistogramBase> HeapAlloc( |
754 const BucketRanges* ranges) override { | 754 const BucketRanges* ranges) override { |
755 return WrapUnique( | 755 return WrapUnique(new LinearHistogram(name_, minimum_, maximum_, ranges)); |
756 new LinearHistogram(name_, minimum_, maximum_, ranges)); | |
757 } | 756 } |
758 | 757 |
759 void FillHistogram(HistogramBase* base_histogram) override { | 758 void FillHistogram(HistogramBase* base_histogram) override { |
760 Histogram::Factory::FillHistogram(base_histogram); | 759 Histogram::Factory::FillHistogram(base_histogram); |
761 LinearHistogram* histogram = static_cast<LinearHistogram*>(base_histogram); | 760 LinearHistogram* histogram = static_cast<LinearHistogram*>(base_histogram); |
762 // Set range descriptions. | 761 // Set range descriptions. |
763 if (descriptions_) { | 762 if (descriptions_) { |
764 for (int i = 0; descriptions_[i].description; ++i) { | 763 for (int i = 0; descriptions_[i].description; ++i) { |
765 histogram->bucket_description_[descriptions_[i].sample] = | 764 histogram->bucket_description_[descriptions_[i].sample] = |
766 descriptions_[i].description; | 765 descriptions_[i].description; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 Sample sample = custom_ranges[i]; | 1179 Sample sample = custom_ranges[i]; |
1181 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) | 1180 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) |
1182 return false; | 1181 return false; |
1183 if (sample != 0) | 1182 if (sample != 0) |
1184 has_valid_range = true; | 1183 has_valid_range = true; |
1185 } | 1184 } |
1186 return has_valid_range; | 1185 return has_valid_range; |
1187 } | 1186 } |
1188 | 1187 |
1189 } // namespace base | 1188 } // namespace base |
OLD | NEW |