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

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

Issue 137623002: Let MetricsService know about some Android Activities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: line warp fix Created 6 years, 10 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 // in memory for an extended period of time, and are vulnerable to memory 22 // in memory for an extended period of time, and are vulnerable to memory
23 // corruption, this class also validates as much rendundancy as it can before 23 // corruption, this class also validates as much rendundancy as it can before
24 // calling for the marginal change (a.k.a., delta) in a histogram to be 24 // calling for the marginal change (a.k.a., delta) in a histogram to be
25 // recorded. 25 // recorded.
26 class BASE_EXPORT HistogramSnapshotManager { 26 class BASE_EXPORT HistogramSnapshotManager {
27 public: 27 public:
28 explicit HistogramSnapshotManager(HistogramFlattener* histogram_flattener); 28 explicit HistogramSnapshotManager(HistogramFlattener* histogram_flattener);
29 virtual ~HistogramSnapshotManager(); 29 virtual ~HistogramSnapshotManager();
30 30
31 // Snapshot all histograms, and ask |histogram_flattener_| to record the 31 // Snapshot all histograms, and ask |histogram_flattener_| to record the
32 // delta. The arguments allow selecting only a subset of histograms for 32 // delta. |flags_to_set| is used to set flags for each histogram.
33 // recording, or to set a flag in each recorded histogram. 33 // |flag_filter_to_record| is used to select histograms to be recorded.
34 void PrepareDeltas(HistogramBase::Flags flags_to_set, bool record_only_uma); 34 // Only histograms that have all the flags specified by the argument will be
35 // chosen. If all histograms should to be recorded, set it to
Ilya Sherman 2014/02/08 00:59:49 nit: "should to be" -> "should be"
Kibeom Kim (inactive) 2014/02/10 22:24:45 Done.
36 // Histogram::kNoFlags .
Ilya Sherman 2014/02/08 00:59:49 nit: Spurious space before the period.
Kibeom Kim (inactive) 2014/02/10 22:24:45 Done.
37 void PrepareDeltas(HistogramBase::Flags flags_to_set,
38 HistogramBase::Flags flag_filter_to_record);
Ilya Sherman 2014/02/08 00:59:49 nit: "flag_filter_to_record" is pretty hard to mak
Kibeom Kim (inactive) 2014/02/10 22:24:45 Done. (thanks for the better naming!)
35 39
36 private: 40 private:
37 // Snapshot this histogram, and record the delta. 41 // Snapshot this histogram, and record the delta.
38 void PrepareDelta(const HistogramBase& histogram); 42 void PrepareDelta(const HistogramBase& histogram);
39 43
40 // Try to detect and fix count inconsistency of logged samples. 44 // Try to detect and fix count inconsistency of logged samples.
41 void InspectLoggedSamplesInconsistency( 45 void InspectLoggedSamplesInconsistency(
42 const HistogramSamples& new_snapshot, 46 const HistogramSamples& new_snapshot,
43 HistogramSamples* logged_samples); 47 HistogramSamples* logged_samples);
44 48
45 // For histograms, track what we've already recorded (as a sample for 49 // For histograms, track what we've already recorded (as a sample for
46 // each histogram) so that we can record only the delta with the next log. 50 // each histogram) so that we can record only the delta with the next log.
47 std::map<std::string, HistogramSamples*> logged_samples_; 51 std::map<std::string, HistogramSamples*> logged_samples_;
48 52
49 // List of histograms found to be corrupt, and their problems. 53 // List of histograms found to be corrupt, and their problems.
50 std::map<std::string, int> inconsistencies_; 54 std::map<std::string, int> inconsistencies_;
51 55
52 // |histogram_flattener_| handles the logistics of recording the histogram 56 // |histogram_flattener_| handles the logistics of recording the histogram
53 // deltas. 57 // deltas.
54 HistogramFlattener* histogram_flattener_; // Weak. 58 HistogramFlattener* histogram_flattener_; // Weak.
55 59
56 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager); 60 DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager);
57 }; 61 };
58 62
59 } // namespace base 63 } // namespace base
60 64
61 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ 65 #endif // BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698