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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 Histogram::ClassType CustomHistogram::histogram_type() const { | 939 Histogram::ClassType CustomHistogram::histogram_type() const { |
940 return CUSTOM_HISTOGRAM; | 940 return CUSTOM_HISTOGRAM; |
941 } | 941 } |
942 | 942 |
943 // static | 943 // static |
944 std::vector<Histogram::Sample> CustomHistogram::ArrayToCustomRanges( | 944 std::vector<Histogram::Sample> CustomHistogram::ArrayToCustomRanges( |
945 const Sample* values, size_t num_values) { | 945 const Sample* values, size_t num_values) { |
946 std::vector<Sample> all_values; | 946 std::vector<Sample> all_values; |
947 for (size_t i = 0; i < num_values; ++i) { | 947 for (size_t i = 0; i < num_values; ++i) { |
948 Sample value = values[i]; | 948 Sample value = values[i]; |
949 DCHECK_GE(value, 0); // You must use positive sample values. | |
jar (doing other things)
2011/05/24 18:10:07
This is a good idea (I love DCHECKS). It would be
Jói
2011/05/24 18:27:31
I moved it to Histogram::SetBucketRange. Let me kn
| |
949 all_values.push_back(value); | 950 all_values.push_back(value); |
950 | 951 |
951 // Ensure that a guard bucket is added. If we end up with duplicate | 952 // Ensure that a guard bucket is added. If we end up with duplicate |
952 // values, FactoryGet will take care of removing them. | 953 // values, FactoryGet will take care of removing them. |
953 all_values.push_back(value + 1); | 954 all_values.push_back(value + 1); |
954 } | 955 } |
955 return all_values; | 956 return all_values; |
956 } | 957 } |
957 | 958 |
958 CustomHistogram::CustomHistogram(const std::string& name, | 959 CustomHistogram::CustomHistogram(const std::string& name, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 } | 1138 } |
1138 | 1139 |
1139 // static | 1140 // static |
1140 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 1141 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
1141 // static | 1142 // static |
1142 base::Lock* StatisticsRecorder::lock_ = NULL; | 1143 base::Lock* StatisticsRecorder::lock_ = NULL; |
1143 // static | 1144 // static |
1144 bool StatisticsRecorder::dump_on_exit_ = false; | 1145 bool StatisticsRecorder::dump_on_exit_ = false; |
1145 | 1146 |
1146 } // namespace base | 1147 } // namespace base |
OLD | NEW |