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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 FillHistogram(tentative_histogram); | 205 FillHistogram(tentative_histogram); |
206 histogram = | 206 histogram = |
207 StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); | 207 StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); |
208 | 208 |
209 // Persistent histograms need some follow-up processing. | 209 // Persistent histograms need some follow-up processing. |
210 if (histogram_ref) { | 210 if (histogram_ref) { |
211 FinalizePersistentHistogram(histogram_ref, | 211 FinalizePersistentHistogram(histogram_ref, |
212 histogram == tentative_histogram); | 212 histogram == tentative_histogram); |
213 } | 213 } |
| 214 |
| 215 // Update report on created histograms. |
| 216 UpdateReportHistogram(histogram, true); |
| 217 } else { |
| 218 // Update report on lookup histograms. |
| 219 UpdateReportHistogram(histogram, false); |
214 } | 220 } |
215 | 221 |
216 DCHECK_EQ(histogram_type_, histogram->GetHistogramType()); | 222 DCHECK_EQ(histogram_type_, histogram->GetHistogramType()) << name_; |
217 if (bucket_count_ != 0 && | 223 if (bucket_count_ != 0 && |
218 !histogram->HasConstructionArguments(minimum_, maximum_, bucket_count_)) { | 224 !histogram->HasConstructionArguments(minimum_, maximum_, bucket_count_)) { |
219 // The construction arguments do not match the existing histogram. This can | 225 // The construction arguments do not match the existing histogram. This can |
220 // come about if an extension updates in the middle of a chrome run and has | 226 // come about if an extension updates in the middle of a chrome run and has |
221 // changed one of them, or simply by bad code within Chrome itself. We | 227 // changed one of them, or simply by bad code within Chrome itself. We |
222 // return NULL here with the expectation that bad code in Chrome will crash | 228 // return NULL here with the expectation that bad code in Chrome will crash |
223 // on dereference, but extension/Pepper APIs will guard against NULL and not | 229 // on dereference, but extension/Pepper APIs will guard against NULL and not |
224 // crash. | 230 // crash. |
225 DLOG(ERROR) << "Histogram " << name_ << " has bad construction arguments"; | 231 DLOG(ERROR) << "Histogram " << name_ << " has bad construction arguments"; |
226 return nullptr; | 232 return nullptr; |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 Sample sample = custom_ranges[i]; | 1161 Sample sample = custom_ranges[i]; |
1156 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) | 1162 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) |
1157 return false; | 1163 return false; |
1158 if (sample != 0) | 1164 if (sample != 0) |
1159 has_valid_range = true; | 1165 has_valid_range = true; |
1160 } | 1166 } |
1161 return has_valid_range; | 1167 return has_valid_range; |
1162 } | 1168 } |
1163 | 1169 |
1164 } // namespace base | 1170 } // namespace base |
OLD | NEW |