| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 private: | 363 private: |
| 364 // For some ranges, we store a printable description of a bucket range. | 364 // For some ranges, we store a printable description of a bucket range. |
| 365 // If there is no desciption, then GetAsciiBucketRange() uses parent class | 365 // If there is no desciption, then GetAsciiBucketRange() uses parent class |
| 366 // to provide a description. | 366 // to provide a description. |
| 367 typedef std::map<Sample, std::string> BucketDescriptionMap; | 367 typedef std::map<Sample, std::string> BucketDescriptionMap; |
| 368 BucketDescriptionMap bucket_description_; | 368 BucketDescriptionMap bucket_description_; |
| 369 | 369 |
| 370 DISALLOW_EVIL_CONSTRUCTORS(LinearHistogram); | 370 DISALLOW_EVIL_CONSTRUCTORS(LinearHistogram); |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 //------------------------------------------------------------------------------ |
| 374 |
| 375 // BooleanHistogram is a histogram for booleans. |
| 376 class BooleanHistogram : public LinearHistogram { |
| 377 public: |
| 378 BooleanHistogram(const wchar_t* name) : LinearHistogram(name, 0, 2, 3) {} |
| 379 |
| 380 virtual void AddBoolean(bool value) { Add(value ? 1 : 0); } |
| 381 |
| 382 private: |
| 383 DISALLOW_EVIL_CONSTRUCTORS(BooleanHistogram); |
| 384 }; |
| 373 | 385 |
| 374 //------------------------------------------------------------------------------ | 386 //------------------------------------------------------------------------------ |
| 375 // This section provides implementation for ThreadSafeHistogram. | 387 // This section provides implementation for ThreadSafeHistogram. |
| 376 //------------------------------------------------------------------------------ | 388 //------------------------------------------------------------------------------ |
| 377 | 389 |
| 378 class ThreadSafeHistogram : public Histogram { | 390 class ThreadSafeHistogram : public Histogram { |
| 379 public: | 391 public: |
| 380 ThreadSafeHistogram(const wchar_t* name, Sample minimum, | 392 ThreadSafeHistogram(const wchar_t* name, Sample minimum, |
| 381 Sample maximum, size_t bucket_count); | 393 Sample maximum, size_t bucket_count); |
| 382 | 394 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 static Lock* lock_; | 455 static Lock* lock_; |
| 444 | 456 |
| 445 // Dump all known histograms to log. | 457 // Dump all known histograms to log. |
| 446 static bool dump_on_exit_; | 458 static bool dump_on_exit_; |
| 447 | 459 |
| 448 DISALLOW_EVIL_CONSTRUCTORS(StatisticsRecorder); | 460 DISALLOW_EVIL_CONSTRUCTORS(StatisticsRecorder); |
| 449 }; | 461 }; |
| 450 | 462 |
| 451 #endif // BASE_HISTOGRAM_H__ | 463 #endif // BASE_HISTOGRAM_H__ |
| 452 | 464 |
| OLD | NEW |