OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // be pointers to data held in that space. | 28 // be pointers to data held in that space. |
29 BASE_EXPORT void SetPersistentHistogramMemoryAllocator( | 29 BASE_EXPORT void SetPersistentHistogramMemoryAllocator( |
30 PersistentMemoryAllocator* allocator); | 30 PersistentMemoryAllocator* allocator); |
31 BASE_EXPORT PersistentMemoryAllocator* GetPersistentHistogramMemoryAllocator(); | 31 BASE_EXPORT PersistentMemoryAllocator* GetPersistentHistogramMemoryAllocator(); |
32 | 32 |
33 // This access to the persistent allocator is only for testing; it extracts | 33 // This access to the persistent allocator is only for testing; it extracts |
34 // the current allocator completely. This allows easy creation of histograms | 34 // the current allocator completely. This allows easy creation of histograms |
35 // within persistent memory segments which can then be extracted and used | 35 // within persistent memory segments which can then be extracted and used |
36 // in other ways. | 36 // in other ways. |
37 BASE_EXPORT PersistentMemoryAllocator* | 37 BASE_EXPORT PersistentMemoryAllocator* |
38 ReleasePersistentHistogramMemoryAllocator(); | 38 ReleasePersistentHistogramMemoryAllocatorForTesting(); |
39 | 39 |
40 // Recreate a Histogram from data held in persistent memory. Though this | 40 // Recreate a Histogram from data held in persistent memory. Though this |
41 // object will be local to the current process, the sample data will be | 41 // object will be local to the current process, the sample data will be |
42 // shared with all other threads referencing it. This method takes a |ref| | 42 // shared with all other threads referencing it. This method takes a |ref| |
43 // to the top- level histogram data and the |allocator| on which it is found. | 43 // to the top- level histogram data and the |allocator| on which it is found. |
44 // This method will return nullptr if any problem is detected with the data. | 44 // This method will return nullptr if any problem is detected with the data. |
45 // The |allocator| may or may not be the same as the PersistentMemoryAllocator | 45 // The |allocator| may or may not be the same as the PersistentMemoryAllocator |
46 // set for general use so that this method can be used to extract Histograms | 46 // set for general use so that this method can be used to extract Histograms |
47 // from persistent memory segments other than the default place that this | 47 // from persistent memory segments other than the default place that this |
48 // process is creating its own histograms. The caller must take ownership of | 48 // process is creating its own histograms. The caller must take ownership of |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // possible for other processes to create histograms in the attached memory | 80 // possible for other processes to create histograms in the attached memory |
81 // segment; this adds those to the internal list of known histograms to | 81 // segment; this adds those to the internal list of known histograms to |
82 // avoid creating duplicates that would have to merged during reporting. | 82 // avoid creating duplicates that would have to merged during reporting. |
83 // Every call to this method resumes from the last entry it saw so it costs | 83 // Every call to this method resumes from the last entry it saw so it costs |
84 // nothing if nothing new has been added. | 84 // nothing if nothing new has been added. |
85 void ImportPersistentHistograms(); | 85 void ImportPersistentHistograms(); |
86 | 86 |
87 } // namespace base | 87 } // namespace base |
88 | 88 |
89 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 89 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
OLD | NEW |