Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: base/metrics/histogram_snapshot_manager.h

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed some build problems Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // PrepareDifference() is works like PrepareDelta() except that it does
Ilya Sherman 2016/04/19 00:57:46 nit: s/is works/works
bcwhite 2016/04/19 16:33:37 Done.
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 PrepareDifference(const HistogramBase* histogram);
Ilya Sherman 2016/04/19 00:57:46 It looks like this method might never be used. Di
bcwhite 2016/04/19 16:33:37 It's used in FileMetricsProvider for atomic files.
Ilya Sherman 2016/04/20 07:12:14 FileMetricsProvider appears to use the TakingOwner
Ilya Sherman 2016/04/20 07:12:14 For the same reason, we wouldn't want to potential
bcwhite 2016/04/20 16:47:45 Oh, I see. You're correct. Those methods are jus
bcwhite 2016/04/20 16:47:45 I'm not following. Each metric on disk has both t
77 void PrepareDifferenceTakingOwnership(
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698