OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 8 |
9 // It supports calls to accumulate either time intervals (which are processed | 9 // It supports calls to accumulate either time intervals (which are processed |
10 // as integral number of milliseconds), or arbitrary integral units. | 10 // as integral number of milliseconds), or arbitrary integral units. |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 // Store a list of number/text values for use in rendering the histogram. | 460 // Store a list of number/text values for use in rendering the histogram. |
461 // The last element in the array has a null in its "description" slot. | 461 // The last element in the array has a null in its "description" slot. |
462 void SetRangeDescriptions(const DescriptionPair descriptions[]); | 462 void SetRangeDescriptions(const DescriptionPair descriptions[]); |
463 | 463 |
464 virtual BucketLayout histogram_type() const { return LINEAR; } | 464 virtual BucketLayout histogram_type() const { return LINEAR; } |
465 | 465 |
466 protected: | 466 protected: |
467 // Initialize ranges_ mapping. | 467 // Initialize ranges_ mapping. |
468 virtual void InitializeBucketRange(); | 468 virtual void InitializeBucketRange(); |
469 // Find bucket to increment for sample value. | |
470 virtual size_t BucketIndex(Sample value) const; | |
471 virtual double GetBucketSize(Count current, size_t i) const; | 469 virtual double GetBucketSize(Count current, size_t i) const; |
472 | 470 |
473 // If we have a description for a bucket, then return that. Otherwise | 471 // If we have a description for a bucket, then return that. Otherwise |
474 // let parent class provide a (numeric) description. | 472 // let parent class provide a (numeric) description. |
475 virtual const std::string GetAsciiBucketRange(size_t i) const; | 473 virtual const std::string GetAsciiBucketRange(size_t i) const; |
476 | 474 |
477 // Skip printing of name for numeric range if we have a name (and if this is | 475 // Skip printing of name for numeric range if we have a name (and if this is |
478 // an empty bucket). | 476 // an empty bucket). |
479 virtual bool PrintEmptyBucket(size_t index) const; | 477 virtual bool PrintEmptyBucket(size_t index) const; |
480 | 478 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // lock protects access to the above map. | 577 // lock protects access to the above map. |
580 static Lock* lock_; | 578 static Lock* lock_; |
581 | 579 |
582 // Dump all known histograms to log. | 580 // Dump all known histograms to log. |
583 static bool dump_on_exit_; | 581 static bool dump_on_exit_; |
584 | 582 |
585 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 583 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
586 }; | 584 }; |
587 | 585 |
588 #endif // BASE_HISTOGRAM_H_ | 586 #endif // BASE_HISTOGRAM_H_ |
OLD | NEW |