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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef BASE_HISTOGRAM_H__ | 31 #ifndef BASE_HISTOGRAM_H__ |
32 #define BASE_HISTOGRAM_H__ | 32 #define BASE_HISTOGRAM_H__ |
33 | 33 |
34 #include <map> | 34 #include <map> |
35 #include <string> | 35 #include <string> |
36 #include <vector> | 36 #include <vector> |
37 | 37 |
38 #include "base/lock.h" | 38 #include "base/lock.h" |
39 #include "base/pickle.h" | 39 #include "base/pickle.h" |
40 #include "base/scoped_ptr.h" | |
41 #include "base/stats_counters.h" | 40 #include "base/stats_counters.h" |
42 | 41 |
43 //------------------------------------------------------------------------------ | 42 //------------------------------------------------------------------------------ |
44 // Provide easy general purpose histogram in a macro, just like stats counters. | 43 // Provide easy general purpose histogram in a macro, just like stats counters. |
45 // The first two macros use 50 buckets. | 44 // The first two macros use 50 buckets. |
46 | 45 |
47 #define HISTOGRAM_TIMES(name, sample) do { \ | 46 #define HISTOGRAM_TIMES(name, sample) do { \ |
48 static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \ | 47 static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \ |
49 base::TimeDelta::FromSeconds(10), 50); \ | 48 base::TimeDelta::FromSeconds(10), 50); \ |
50 counter.AddTime(sample); \ | 49 counter.AddTime(sample); \ |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // lock protects access to the above map. | 520 // lock protects access to the above map. |
522 static Lock* lock_; | 521 static Lock* lock_; |
523 | 522 |
524 // Dump all known histograms to log. | 523 // Dump all known histograms to log. |
525 static bool dump_on_exit_; | 524 static bool dump_on_exit_; |
526 | 525 |
527 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 526 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
528 }; | 527 }; |
529 | 528 |
530 #endif // BASE_HISTOGRAM_H__ | 529 #endif // BASE_HISTOGRAM_H__ |
OLD | NEW |