| 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 | |
| 126 protected: | 119 protected: |
| 127 // The structure used to hold histogram data in persistent memory. It is | 120 // The structure used to hold histogram data in persistent memory. It is |
| 128 // defined and used entirely within the .cc file. | 121 // defined and used entirely within the .cc file. |
| 129 struct PersistentHistogramData; | 122 struct PersistentHistogramData; |
| 130 | 123 |
| 131 // Gets the reference of the last histogram created, used to avoid | 124 // Gets the reference of the last histogram created, used to avoid |
| 132 // trying to import what was just created. | 125 // trying to import what was just created. |
| 133 PersistentHistogramAllocator::Reference last_created() { | 126 PersistentHistogramAllocator::Reference last_created() { |
| 134 return subtle::NoBarrier_Load(&last_created_); | 127 return subtle::NoBarrier_Load(&last_created_); |
| 135 } | 128 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Import always continues from where it left off, making use of a single | 258 // Import always continues from where it left off, making use of a single |
| 266 // iterator to continue the work. | 259 // iterator to continue the work. |
| 267 Iterator import_iterator_; | 260 Iterator import_iterator_; |
| 268 | 261 |
| 269 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); | 262 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); |
| 270 }; | 263 }; |
| 271 | 264 |
| 272 } // namespace base | 265 } // namespace base |
| 273 | 266 |
| 274 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 267 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| OLD | NEW |