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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 // static | 454 // static |
455 bool Histogram::InspectConstructionArguments(const string& name, | 455 bool Histogram::InspectConstructionArguments(const string& name, |
456 Sample* minimum, | 456 Sample* minimum, |
457 Sample* maximum, | 457 Sample* maximum, |
458 size_t* bucket_count) { | 458 size_t* bucket_count) { |
459 // Defensive code for backward compatibility. | 459 // Defensive code for backward compatibility. |
460 if (*minimum < 1) { | 460 if (*minimum < 1) { |
461 DLOG(WARNING) << "Histogram: " << name << " Bad minimum: " << *minimum; | 461 DVLOG(1) << "Histogram: " << name << " has bad minimum: " << *minimum; |
462 *minimum = 1; | 462 *minimum = 1; |
463 } | 463 } |
464 if (*maximum >= kSampleType_MAX) { | 464 if (*maximum >= kSampleType_MAX) { |
465 DLOG(WARNING) << "Histogram: " << name << " Bad maximum: " << *maximum; | 465 DVLOG(1) << "Histogram: " << name << " has bad maximum: " << *maximum; |
466 *maximum = kSampleType_MAX; | 466 *maximum = kSampleType_MAX - 1; |
467 } | 467 } |
468 | 468 |
469 if (*bucket_count < 3 || *bucket_count >= kBucketCount_MAX) | 469 if (*bucket_count < 3 || *bucket_count >= kBucketCount_MAX) |
470 return false; | 470 return false; |
471 if (*bucket_count > static_cast<size_t>(*maximum - *minimum + 2)) | 471 if (*bucket_count > static_cast<size_t>(*maximum - *minimum + 2)) |
472 return false; | 472 return false; |
473 return true; | 473 return true; |
474 } | 474 } |
475 | 475 |
476 bool Histogram::SerializeRanges(Pickle* pickle) const { | 476 bool Histogram::SerializeRanges(Pickle* pickle) const { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); | 906 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); |
907 for (size_t i = 0; i < ranges.size(); i++) { | 907 for (size_t i = 0; i < ranges.size(); i++) { |
908 bucket_ranges->set_range(i, ranges[i]); | 908 bucket_ranges->set_range(i, ranges[i]); |
909 } | 909 } |
910 bucket_ranges->ResetChecksum(); | 910 bucket_ranges->ResetChecksum(); |
911 return bucket_ranges; | 911 return bucket_ranges; |
912 } | 912 } |
913 | 913 |
914 } // namespace base | 914 } // namespace base |
OLD | NEW |