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 // See header file for details and examples. | 8 // See header file for details and examples. |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 HistogramBase* Histogram::FactoryTimeGet(const string& name, | 117 HistogramBase* Histogram::FactoryTimeGet(const string& name, |
118 TimeDelta minimum, | 118 TimeDelta minimum, |
119 TimeDelta maximum, | 119 TimeDelta maximum, |
120 size_t bucket_count, | 120 size_t bucket_count, |
121 int32 flags) { | 121 int32 flags) { |
122 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), | 122 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), |
123 bucket_count, flags); | 123 bucket_count, flags); |
124 } | 124 } |
125 | 125 |
| 126 HistogramBase* Histogram::FactoryTimeGetAndAtomicRelease( |
| 127 base::subtle::AtomicWord* atomic_histogram_pointer, |
| 128 const string& name, |
| 129 TimeDelta minimum, |
| 130 TimeDelta maximum, |
| 131 size_t bucket_count, |
| 132 int32 flags) { |
| 133 HistogramBase* retval = FactoryGet(name, minimum.InMilliseconds(), maximum.InM
illiseconds(), |
| 134 bucket_count, flags); |
| 135 base::subtle::Release_Store(atomic_histogram_pointer, |
| 136 reinterpret_cast<base::subtle::AtomicWord>(retval)
); |
| 137 return retval; |
| 138 } |
| 139 |
126 TimeTicks Histogram::DebugNow() { | 140 TimeTicks Histogram::DebugNow() { |
127 #ifndef NDEBUG | 141 #ifndef NDEBUG |
128 return TimeTicks::Now(); | 142 return TimeTicks::Now(); |
129 #else | 143 #else |
130 return TimeTicks(); | 144 return TimeTicks(); |
131 #endif | 145 #endif |
132 } | 146 } |
133 | 147 |
134 // Calculate what range of values are held in each bucket. | 148 // Calculate what range of values are held in each bucket. |
135 // We have to be careful that we don't pick a ratio between starting points in | 149 // We have to be careful that we don't pick a ratio between starting points in |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 839 |
826 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); | 840 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); |
827 for (size_t i = 0; i < ranges.size(); i++) { | 841 for (size_t i = 0; i < ranges.size(); i++) { |
828 bucket_ranges->set_range(i, ranges[i]); | 842 bucket_ranges->set_range(i, ranges[i]); |
829 } | 843 } |
830 bucket_ranges->ResetChecksum(); | 844 bucket_ranges->ResetChecksum(); |
831 return bucket_ranges; | 845 return bucket_ranges; |
832 } | 846 } |
833 | 847 |
834 } // namespace base | 848 } // namespace base |
OLD | NEW |