| 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 // PersistentSampleMap implements HistogramSamples interface. It is used | 5 // PersistentSampleMap implements HistogramSamples interface. It is used |
| 6 // by the SparseHistogram class to store samples in persistent memory which | 6 // by the SparseHistogram class to store samples in persistent memory which |
| 7 // allows it to be shared between processes or live across restarts. | 7 // allows it to be shared between processes or live across restarts. |
| 8 | 8 |
| 9 #ifndef BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ | 9 #ifndef BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ |
| 10 #define BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ | 10 #define BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ |
| 11 | 11 |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <memory> | 15 #include <memory> |
| 16 | 16 |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/metrics/histogram_base.h" | 19 #include "base/metrics/histogram_base.h" |
| 20 #include "base/metrics/histogram_samples.h" | 20 #include "base/metrics/histogram_samples.h" |
| 21 #include "base/metrics/persistent_memory_allocator.h" | 21 #include "base/metrics/persistent_memory_allocator.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 | 24 |
| 25 class PersistentHistogramAllocator; | 25 class PersistentHistogramAllocator; |
| 26 class PersistentSampleMapRecords; | 26 class PersistentSampleMapRecords; |
| 27 class PersistentSparseHistogramDataManager; | |
| 28 | 27 |
| 29 // The logic here is similar to that of SampleMap but with different data | 28 // The logic here is similar to that of SampleMap but with different data |
| 30 // structures. Changes here likely need to be duplicated there. | 29 // structures. Changes here likely need to be duplicated there. |
| 31 class BASE_EXPORT PersistentSampleMap : public HistogramSamples { | 30 class BASE_EXPORT PersistentSampleMap : public HistogramSamples { |
| 32 public: | 31 public: |
| 33 // Constructs a persistent sample map using a PersistentHistogramAllocator | 32 // Constructs a persistent sample map using a PersistentHistogramAllocator |
| 34 // as the data source for persistent records. | 33 // as the data source for persistent records. |
| 35 PersistentSampleMap(uint64_t id, | 34 PersistentSampleMap(uint64_t id, |
| 36 PersistentHistogramAllocator* allocator, | 35 PersistentHistogramAllocator* allocator, |
| 37 Metadata* meta); | 36 Metadata* meta); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // live beyond the life of this object. This value is lazily-initialized on | 100 // live beyond the life of this object. This value is lazily-initialized on |
| 102 // first use via the GetRecords() accessor method. | 101 // first use via the GetRecords() accessor method. |
| 103 PersistentSampleMapRecords* records_ = nullptr; | 102 PersistentSampleMapRecords* records_ = nullptr; |
| 104 | 103 |
| 105 DISALLOW_COPY_AND_ASSIGN(PersistentSampleMap); | 104 DISALLOW_COPY_AND_ASSIGN(PersistentSampleMap); |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 } // namespace base | 107 } // namespace base |
| 109 | 108 |
| 110 #endif // BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ | 109 #endif // BASE_METRICS_PERSISTENT_SAMPLE_MAP_H_ |
| OLD | NEW |