| 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 | 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 do { \ | 148 do { \ |
| 149 static base::subtle::AtomicWord atomic_histogram_pointer = 0; \ | 149 static base::subtle::AtomicWord atomic_histogram_pointer = 0; \ |
| 150 base::HistogramBase* histogram_pointer( \ | 150 base::HistogramBase* histogram_pointer( \ |
| 151 reinterpret_cast<base::HistogramBase*>( \ | 151 reinterpret_cast<base::HistogramBase*>( \ |
| 152 base::subtle::Acquire_Load(&atomic_histogram_pointer))); \ | 152 base::subtle::Acquire_Load(&atomic_histogram_pointer))); \ |
| 153 if (!histogram_pointer) { \ | 153 if (!histogram_pointer) { \ |
| 154 histogram_pointer = histogram_factory_get_invocation; \ | 154 histogram_pointer = histogram_factory_get_invocation; \ |
| 155 base::subtle::Release_Store(&atomic_histogram_pointer, \ | 155 base::subtle::Release_Store(&atomic_histogram_pointer, \ |
| 156 reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); \ | 156 reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); \ |
| 157 } \ | 157 } \ |
| 158 if (DCHECK_IS_ON()) \ | 158 if (DCHECK_IS_ON) \ |
| 159 histogram_pointer->CheckName(constant_histogram_name); \ | 159 histogram_pointer->CheckName(constant_histogram_name); \ |
| 160 histogram_pointer->histogram_add_method_invocation; \ | 160 histogram_pointer->histogram_add_method_invocation; \ |
| 161 } while (0) | 161 } while (0) |
| 162 | 162 |
| 163 | 163 |
| 164 //------------------------------------------------------------------------------ | 164 //------------------------------------------------------------------------------ |
| 165 // Provide easy general purpose histogram in a macro, just like stats counters. | 165 // Provide easy general purpose histogram in a macro, just like stats counters. |
| 166 // The first four macros use 50 buckets. | 166 // The first four macros use 50 buckets. |
| 167 | 167 |
| 168 #define HISTOGRAM_TIMES(name, sample) HISTOGRAM_CUSTOM_TIMES( \ | 168 #define HISTOGRAM_TIMES(name, sample) HISTOGRAM_CUSTOM_TIMES( \ |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); | 684 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); |
| 685 static BucketRanges* CreateBucketRangesFromCustomRanges( | 685 static BucketRanges* CreateBucketRangesFromCustomRanges( |
| 686 const std::vector<Sample>& custom_ranges); | 686 const std::vector<Sample>& custom_ranges); |
| 687 | 687 |
| 688 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); | 688 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); |
| 689 }; | 689 }; |
| 690 | 690 |
| 691 } // namespace base | 691 } // namespace base |
| 692 | 692 |
| 693 #endif // BASE_METRICS_HISTOGRAM_H_ | 693 #endif // BASE_METRICS_HISTOGRAM_H_ |
| OLD | NEW |