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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 HistogramBase* Histogram::FactoryTimeGet(const string& name, | 126 HistogramBase* Histogram::FactoryTimeGet(const string& name, |
127 TimeDelta minimum, | 127 TimeDelta minimum, |
128 TimeDelta maximum, | 128 TimeDelta maximum, |
129 size_t bucket_count, | 129 size_t bucket_count, |
130 int32 flags) { | 130 int32 flags) { |
131 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), | 131 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), |
132 bucket_count, flags); | 132 bucket_count, flags); |
133 } | 133 } |
134 | 134 |
135 TimeTicks Histogram::DebugNow() { | |
136 #ifndef NDEBUG | |
137 return TimeTicks::Now(); | |
138 #else | |
139 return TimeTicks(); | |
140 #endif | |
141 } | |
142 | |
143 // Calculate what range of values are held in each bucket. | 135 // Calculate what range of values are held in each bucket. |
144 // We have to be careful that we don't pick a ratio between starting points in | 136 // We have to be careful that we don't pick a ratio between starting points in |
145 // consecutive buckets that is sooo small, that the integer bounds are the same | 137 // consecutive buckets that is sooo small, that the integer bounds are the same |
146 // (effectively making one bucket get no values). We need to avoid: | 138 // (effectively making one bucket get no values). We need to avoid: |
147 // ranges(i) == ranges(i + 1) | 139 // ranges(i) == ranges(i + 1) |
148 // To avoid that, we just do a fine-grained bucket width as far as we need to | 140 // To avoid that, we just do a fine-grained bucket width as far as we need to |
149 // until we get a ratio that moves us along at least 2 units at a time. From | 141 // until we get a ratio that moves us along at least 2 units at a time. From |
150 // that bucket onward we do use the exponential growth of buckets. | 142 // that bucket onward we do use the exponential growth of buckets. |
151 // | 143 // |
152 // static | 144 // static |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 835 |
844 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); | 836 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); |
845 for (size_t i = 0; i < ranges.size(); i++) { | 837 for (size_t i = 0; i < ranges.size(); i++) { |
846 bucket_ranges->set_range(i, ranges[i]); | 838 bucket_ranges->set_range(i, ranges[i]); |
847 } | 839 } |
848 bucket_ranges->ResetChecksum(); | 840 bucket_ranges->ResetChecksum(); |
849 return bucket_ranges; | 841 return bucket_ranges; |
850 } | 842 } |
851 | 843 |
852 } // namespace base | 844 } // namespace base |
OLD | NEW |