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 PrepareFinalDelta(const HistogramBase* histogram); | |
Ilya Sherman
2016/05/04 06:48:07
nit: Only the TakingOwnership() method is used, so
bcwhite
2016/05/04 14:12:50
<shudder> I hate inconsistent APIs. But done.
| |
77 void PrepareFinalDeltaTakingOwnership( | |
78 std::unique_ptr<const HistogramBase> histogram); | |
73 void FinishDeltas(); | 79 void FinishDeltas(); |
74 | 80 |
75 private: | 81 private: |
76 FRIEND_TEST_ALL_PREFIXES(HistogramSnapshotManagerTest, CheckMerge); | 82 FRIEND_TEST_ALL_PREFIXES(HistogramSnapshotManagerTest, CheckMerge); |
77 | 83 |
78 // During a snapshot, samples are acquired and aggregated. This structure | 84 // During a snapshot, samples are acquired and aggregated. This structure |
79 // contains all the information collected for a given histogram. Once a | 85 // contains all the information collected for a given histogram. Once a |
80 // snapshot operation is finished, it is generally emptied except for | 86 // snapshot operation is finished, it is generally emptied except for |
81 // information that must persist from one report to the next, such as | 87 // information that must persist from one report to the next, such as |
82 // the "inconsistencies". | 88 // 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 | 127 // |histogram_flattener_| handles the logistics of recording the histogram |
122 // deltas. | 128 // deltas. |
123 HistogramFlattener* histogram_flattener_; // Weak. | 129 HistogramFlattener* histogram_flattener_; // Weak. |
124 | 130 |
125 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); | 131 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); |
126 }; | 132 }; |
127 | 133 |
128 } // namespace base | 134 } // namespace base |
129 | 135 |
130 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ | 136 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ |
OLD | NEW |