OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml | 109 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml |
110 // with the following histograms: | 110 // with the following histograms: |
111 // UMA.PersistentAllocator.name.Allocs | 111 // UMA.PersistentAllocator.name.Allocs |
112 // UMA.PersistentAllocator.name.UsedPct | 112 // UMA.PersistentAllocator.name.UsedPct |
113 void CreateTrackingHistograms(StringPiece name); | 113 void CreateTrackingHistograms(StringPiece name); |
114 void UpdateTrackingHistograms(); | 114 void UpdateTrackingHistograms(); |
115 | 115 |
116 // Histogram containing creation results. Visible for testing. | 116 // Histogram containing creation results. Visible for testing. |
117 static HistogramBase* GetCreateHistogramResultHistogram(); | 117 static HistogramBase* GetCreateHistogramResultHistogram(); |
118 | 118 |
| 119 // This access to the persistent allocator is only for testing; it extracts |
| 120 // the current allocator completely. This allows easy creation of histograms |
| 121 // within persistent memory segments which can then be extracted and used |
| 122 // in other ways. |
| 123 static std::unique_ptr<PersistentHistogramAllocator> |
| 124 ReleaseGlobalAllocatorForTesting(); |
| 125 |
119 protected: | 126 protected: |
120 // The structure used to hold histogram data in persistent memory. It is | 127 // The structure used to hold histogram data in persistent memory. It is |
121 // defined and used entirely within the .cc file. | 128 // defined and used entirely within the .cc file. |
122 struct PersistentHistogramData; | 129 struct PersistentHistogramData; |
123 | 130 |
124 // Gets the reference of the last histogram created, used to avoid | 131 // Gets the reference of the last histogram created, used to avoid |
125 // trying to import what was just created. | 132 // trying to import what was just created. |
126 PersistentHistogramAllocator::Reference last_created() { | 133 PersistentHistogramAllocator::Reference last_created() { |
127 return subtle::NoBarrier_Load(&last_created_); | 134 return subtle::NoBarrier_Load(&last_created_); |
128 } | 135 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Import always continues from where it left off, making use of a single | 265 // Import always continues from where it left off, making use of a single |
259 // iterator to continue the work. | 266 // iterator to continue the work. |
260 Iterator import_iterator_; | 267 Iterator import_iterator_; |
261 | 268 |
262 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); | 269 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); |
263 }; | 270 }; |
264 | 271 |
265 } // namespace base | 272 } // namespace base |
266 | 273 |
267 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 274 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
OLD | NEW |