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 #ifndef BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ |
6 #define BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ | 6 #define BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 FinishDeltas(); | 55 FinishDeltas(); |
56 } | 56 } |
57 | 57 |
58 // When the collection is not so simple as can be done using a single | 58 // When the collection is not so simple as can be done using a single |
59 // iterator, the steps can be performed separately. Call PerpareDelta() | 59 // iterator, the steps can be performed separately. Call PerpareDelta() |
60 // as many times as necessary with a single StartDeltas() before and | 60 // as many times as necessary with a single StartDeltas() before and |
61 // a single FinishDeltas() after. All passed histograms must live | 61 // a single FinishDeltas() after. All passed histograms must live |
62 // until FinishDeltas() completes. PrepareAbsolute() works the same | 62 // until FinishDeltas() completes. PrepareAbsolute() works the same |
63 // but assumes there were no previous logged values and no future deltas | 63 // but assumes there were no previous logged values and no future deltas |
64 // will be created (and thus can work on read-only histograms). | 64 // will be created (and thus can work on read-only histograms). |
| 65 // PrepareFinalDelta() works like PrepareDelta() except that it does |
| 66 // not update the previous logged values and can thus be used with |
| 67 // read-only files. |
65 // Use Prepare*TakingOwnership() if it is desireable to have this class | 68 // Use Prepare*TakingOwnership() if it is desireable to have this class |
66 // automatically delete the histogram once it is "finished". | 69 // automatically delete the histogram once it is "finished". |
67 void StartDeltas(); | 70 void StartDeltas(); |
68 void PrepareDelta(HistogramBase* histogram); | 71 void PrepareDelta(HistogramBase* histogram); |
69 void PrepareDeltaTakingOwnership(std::unique_ptr<HistogramBase> histogram); | 72 void PrepareDeltaTakingOwnership(std::unique_ptr<HistogramBase> histogram); |
70 void PrepareAbsolute(const HistogramBase* histogram); | 73 void PrepareAbsolute(const HistogramBase* histogram); |
71 void PrepareAbsoluteTakingOwnership( | 74 void PrepareAbsoluteTakingOwnership( |
72 std::unique_ptr<const HistogramBase> histogram); | 75 std::unique_ptr<const HistogramBase> histogram); |
| 76 void PrepareFinalDeltaTakingOwnership( |
| 77 std::unique_ptr<const HistogramBase> histogram); |
73 void FinishDeltas(); | 78 void FinishDeltas(); |
74 | 79 |
75 private: | 80 private: |
76 FRIEND_TEST_ALL_PREFIXES(HistogramSnapshotManagerTest, CheckMerge); | 81 FRIEND_TEST_ALL_PREFIXES(HistogramSnapshotManagerTest, CheckMerge); |
77 | 82 |
78 // During a snapshot, samples are acquired and aggregated. This structure | 83 // During a snapshot, samples are acquired and aggregated. This structure |
79 // contains all the information collected for a given histogram. Once a | 84 // contains all the information collected for a given histogram. Once a |
80 // snapshot operation is finished, it is generally emptied except for | 85 // snapshot operation is finished, it is generally emptied except for |
81 // information that must persist from one report to the next, such as | 86 // information that must persist from one report to the next, such as |
82 // the "inconsistencies". | 87 // the "inconsistencies". |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // |histogram_flattener_| handles the logistics of recording the histogram | 126 // |histogram_flattener_| handles the logistics of recording the histogram |
122 // deltas. | 127 // deltas. |
123 HistogramFlattener* histogram_flattener_; // Weak. | 128 HistogramFlattener* histogram_flattener_; // Weak. |
124 | 129 |
125 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); | 130 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); |
126 }; | 131 }; |
127 | 132 |
128 } // namespace base | 133 } // namespace base |
129 | 134 |
130 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ | 135 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ |
OLD | NEW |