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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 // cases (such as with a CustomHistogram), they are calculated dynamically | 165 // cases (such as with a CustomHistogram), they are calculated dynamically |
166 // at run-time. In the latter case, those ctor parameters are zero and | 166 // at run-time. In the latter case, those ctor parameters are zero and |
167 // the results extracted from the result of CreateRanges(). | 167 // the results extracted from the result of CreateRanges(). |
168 if (bucket_count_ == 0) { | 168 if (bucket_count_ == 0) { |
169 bucket_count_ = static_cast<uint32_t>(registered_ranges->bucket_count()); | 169 bucket_count_ = static_cast<uint32_t>(registered_ranges->bucket_count()); |
170 minimum_ = registered_ranges->range(1); | 170 minimum_ = registered_ranges->range(1); |
171 maximum_ = registered_ranges->range(bucket_count_ - 1); | 171 maximum_ = registered_ranges->range(bucket_count_ - 1); |
172 } | 172 } |
173 | 173 |
174 // Try to create the histogram using a "persistent" allocator. As of | 174 // Try to create the histogram using a "persistent" allocator. As of |
175 // 2015-01-14, the availability of such is controlled by a base::Feature | 175 // 2016-02-25, the availability of such is controlled by a base::Feature |
grt (UTC plus 2)
2016/03/02 20:00:42
updating this date repeatedly is cumbersome. wdyt
bcwhite
2016/03/02 22:32:43
I don't plan to update it repeatedly. I just upda
| |
176 // that is off by default. If the allocator doesn't exist or if | 176 // that is off by default. If the allocator doesn't exist or if |
177 // allocating from it fails, code below will allocate the histogram from | 177 // allocating from it fails, code below will allocate the histogram from |
178 // the process heap. | 178 // the process heap. |
179 PersistentMemoryAllocator::Reference histogram_ref = 0; | 179 PersistentMemoryAllocator::Reference histogram_ref = 0; |
180 HistogramBase* tentative_histogram = nullptr; | 180 HistogramBase* tentative_histogram = nullptr; |
181 PersistentMemoryAllocator* allocator = | 181 PersistentMemoryAllocator* allocator = |
182 GetPersistentHistogramMemoryAllocator(); | 182 GetPersistentHistogramMemoryAllocator(); |
183 if (allocator) { | 183 if (allocator) { |
184 flags_ |= HistogramBase::kIsPersistent; | 184 flags_ |= HistogramBase::kIsPersistent; |
185 tentative_histogram = AllocatePersistentHistogram( | 185 tentative_histogram = AllocatePersistentHistogram( |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1155 Sample sample = custom_ranges[i]; | 1155 Sample sample = custom_ranges[i]; |
1156 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) | 1156 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) |
1157 return false; | 1157 return false; |
1158 if (sample != 0) | 1158 if (sample != 0) |
1159 has_valid_range = true; | 1159 has_valid_range = true; |
1160 } | 1160 } |
1161 return has_valid_range; | 1161 return has_valid_range; |
1162 } | 1162 } |
1163 | 1163 |
1164 } // namespace base | 1164 } // namespace base |
OLD | NEW |