Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: base/metrics/histogram.cc

Issue 6990058: Switch to the new CustomHistogram::ArrayToCustomRanges() utility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698