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

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

Issue 10829466: SampleSet -> HistogramSamples (will be reused by SparseHistogram) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 12 matching lines...) Expand all
23 // calling for the marginal change (a.k.a., delta) in a histogram to be 23 // calling for the marginal change (a.k.a., delta) in a histogram to be
24 // recorded. 24 // recorded.
25 class BASE_EXPORT HistogramSnapshotManager { 25 class BASE_EXPORT HistogramSnapshotManager {
26 public: 26 public:
27 explicit HistogramSnapshotManager(HistogramFlattener* histogram_flattener); 27 explicit HistogramSnapshotManager(HistogramFlattener* histogram_flattener);
28 virtual ~HistogramSnapshotManager(); 28 virtual ~HistogramSnapshotManager();
29 29
30 // Snapshot all histograms, and ask |histogram_flattener_| to record the 30 // Snapshot all histograms, and ask |histogram_flattener_| to record the
31 // delta. The arguments allow selecting only a subset of histograms for 31 // delta. The arguments allow selecting only a subset of histograms for
32 // recording, or to set a flag in each recorded histogram. 32 // recording, or to set a flag in each recorded histogram.
33 void PrepareDeltas(base::Histogram::Flags flags_to_set, bool record_only_uma); 33 void PrepareDeltas(Histogram::Flags flags_to_set, bool record_only_uma);
34 34
35 private: 35 private:
36 // Maintain a map of histogram names to the sample stats we've recorded. 36 // Snapshot this histogram, and record the delta.
37 typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; 37 void PrepareDelta(const Histogram& histogram);
38 // List of histograms names, and their encontered corruptions.
39 typedef std::map<std::string, int> ProblemMap;
40 38
41 // Snapshot this histogram, and record the delta. 39 // Try to detect and fix count inconsistency of logged samples.
42 void PrepareDelta(const base::Histogram& histogram); 40 void InspectLoggedSamplesInconsistency(
41 const HistogramSamples& new_snapshot,
42 HistogramSamples* logged_samples);
43 43
44 // For histograms, track what we've already recorded (as a sample for 44 // For histograms, track what we've already recorded (as a sample for
45 // each histogram) so that we can record only the delta with the next log. 45 // each histogram) so that we can record only the delta with the next log.
46 LoggedSampleMap logged_samples_; 46 std::map<std::string, HistogramSamples*> logged_samples_;
47 47
48 // List of histograms found corrupt to be corrupt, and their problems. 48 // List of histograms found corrupt to be corrupt, and their problems.
49 scoped_ptr<ProblemMap> inconsistencies_; 49 std::map<std::string, int> inconsistencies_;
50 50
51 // |histogram_flattener_| handles the logistics of recording the histogram 51 // |histogram_flattener_| handles the logistics of recording the histogram
52 // deltas. 52 // deltas.
53 HistogramFlattener* histogram_flattener_; // Weak. 53 HistogramFlattener* histogram_flattener_; // Weak.
54 54
55 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); 55 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager);
56 }; 56 };
57 57
58 } // namespace base 58 } // namespace base
59 59
60 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ 60 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698