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

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

Issue 6592043: Fix compilation bug on ARM... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 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
« no previous file with comments | « base/metrics/histogram.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 if (ranges.size() <= 1) { 921 if (ranges.size() <= 1) {
922 DCHECK(false); 922 DCHECK(false);
923 // Note that we pushed a 0 in above, so for defensive code.... 923 // Note that we pushed a 0 in above, so for defensive code....
924 ranges.push_back(1); // Put in some data so we can index to [1]. 924 ranges.push_back(1); // Put in some data so we can index to [1].
925 } 925 }
926 926
927 DCHECK_LT(ranges.back(), kSampleType_MAX); 927 DCHECK_LT(ranges.back(), kSampleType_MAX);
928 928
929 if (!StatisticsRecorder::FindHistogram(name, &histogram)) { 929 if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
930 CustomHistogram* custom_histogram = new CustomHistogram(name, ranges); 930 CustomHistogram* custom_histogram = new CustomHistogram(name, ranges);
931 custom_histogram->InitializeBucketRange(ranges); 931 custom_histogram->InitializedCustomBucketRange(ranges);
932 histogram = custom_histogram; 932 histogram = custom_histogram;
933 StatisticsRecorder::Register(&histogram); 933 StatisticsRecorder::Register(&histogram);
934 } 934 }
935 935
936 DCHECK_EQ(histogram->histogram_type(), CUSTOM_HISTOGRAM); 936 DCHECK_EQ(histogram->histogram_type(), CUSTOM_HISTOGRAM);
937 DCHECK(histogram->HasConstructorArguments(ranges[1], ranges.back(), 937 DCHECK(histogram->HasConstructorArguments(ranges[1], ranges.back(),
938 ranges.size())); 938 ranges.size()));
939 histogram->SetFlags(flags); 939 histogram->SetFlags(flags);
940 return histogram; 940 return histogram;
941 } 941 }
942 942
943 Histogram::ClassType CustomHistogram::histogram_type() const { 943 Histogram::ClassType CustomHistogram::histogram_type() const {
944 return CUSTOM_HISTOGRAM; 944 return CUSTOM_HISTOGRAM;
945 } 945 }
946 946
947 CustomHistogram::CustomHistogram(const std::string& name, 947 CustomHistogram::CustomHistogram(const std::string& name,
948 const std::vector<Sample>& custom_ranges) 948 const std::vector<Sample>& custom_ranges)
949 : Histogram(name, custom_ranges[1], custom_ranges.back(), 949 : Histogram(name, custom_ranges[1], custom_ranges.back(),
950 custom_ranges.size()) { 950 custom_ranges.size()) {
951 DCHECK_GT(custom_ranges.size(), 1u); 951 DCHECK_GT(custom_ranges.size(), 1u);
952 DCHECK_EQ(custom_ranges[0], 0); 952 DCHECK_EQ(custom_ranges[0], 0);
953 } 953 }
954 954
955 void CustomHistogram::InitializeBucketRange( 955 void CustomHistogram::InitializedCustomBucketRange(
956 const std::vector<Sample>& custom_ranges) { 956 const std::vector<Sample>& custom_ranges) {
957 DCHECK_GT(custom_ranges.size(), 1u); 957 DCHECK_GT(custom_ranges.size(), 1u);
958 DCHECK_EQ(custom_ranges[0], 0); 958 DCHECK_EQ(custom_ranges[0], 0);
959 DCHECK_LE(custom_ranges.size(), bucket_count()); 959 DCHECK_LE(custom_ranges.size(), bucket_count());
960 for (size_t index = 0; index < custom_ranges.size(); ++index) 960 for (size_t index = 0; index < custom_ranges.size(); ++index)
961 SetBucketRange(index, custom_ranges[index]); 961 SetBucketRange(index, custom_ranges[index]);
962 ResetRangeChecksum(); 962 ResetRangeChecksum();
963 } 963 }
964 964
965 double CustomHistogram::GetBucketSize(Count current, size_t i) const { 965 double CustomHistogram::GetBucketSize(Count current, size_t i) const {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 } 1129 }
1130 1130
1131 // static 1131 // static
1132 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; 1132 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
1133 // static 1133 // static
1134 base::Lock* StatisticsRecorder::lock_ = NULL; 1134 base::Lock* StatisticsRecorder::lock_ = NULL;
1135 // static 1135 // static
1136 bool StatisticsRecorder::dump_on_exit_ = false; 1136 bool StatisticsRecorder::dump_on_exit_ = false;
1137 1137
1138 } // namespace base 1138 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698