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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \ | 47 static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \ |
48 base::TimeDelta::FromSeconds(10), 50); \ | 48 base::TimeDelta::FromSeconds(10), 50); \ |
49 counter.AddTime(sample); \ | 49 counter.AddTime(sample); \ |
50 } while (0) | 50 } while (0) |
51 | 51 |
52 #define HISTOGRAM_COUNTS(name, sample) do { \ | 52 #define HISTOGRAM_COUNTS(name, sample) do { \ |
53 static Histogram counter((name), 1, 1000000, 50); \ | 53 static Histogram counter((name), 1, 1000000, 50); \ |
54 counter.Add(sample); \ | 54 counter.Add(sample); \ |
55 } while (0) | 55 } while (0) |
56 | 56 |
| 57 #define HISTOGRAM_COUNTS_100(name, sample) do { \ |
| 58 static Histogram counter((name), 1, 100, 50); \ |
| 59 counter.Add(sample); \ |
| 60 } while (0) |
| 61 |
57 // For folks that need real specific times, use this, but you'll only get | 62 // For folks that need real specific times, use this, but you'll only get |
58 // samples that are in the range (overly large samples are discarded). | 63 // samples that are in the range (overly large samples are discarded). |
59 #define HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \ | 64 #define HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \ |
60 static Histogram counter((name), min, max, bucket_count); \ | 65 static Histogram counter((name), min, max, bucket_count); \ |
61 if ((sample) < (max)) counter.AddTime(sample); \ | 66 if ((sample) < (max)) counter.AddTime(sample); \ |
62 } while (0) | 67 } while (0) |
63 | 68 |
64 //------------------------------------------------------------------------------ | 69 //------------------------------------------------------------------------------ |
65 // This macro set is for a histogram that can support both addition and removal | 70 // This macro set is for a histogram that can support both addition and removal |
66 // of samples. It should be used to render the accumulated asset allocation | 71 // of samples. It should be used to render the accumulated asset allocation |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 static Lock* lock_; | 479 static Lock* lock_; |
475 | 480 |
476 // Dump all known histograms to log. | 481 // Dump all known histograms to log. |
477 static bool dump_on_exit_; | 482 static bool dump_on_exit_; |
478 | 483 |
479 DISALLOW_EVIL_CONSTRUCTORS(StatisticsRecorder); | 484 DISALLOW_EVIL_CONSTRUCTORS(StatisticsRecorder); |
480 }; | 485 }; |
481 | 486 |
482 #endif // BASE_HISTOGRAM_H__ | 487 #endif // BASE_HISTOGRAM_H__ |
483 | 488 |
OLD | NEW |