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

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

Issue 27460003: Consolidate serialization code in base::HistogramDeltasSerializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 // StatisticsRecorder holds all Histograms and BucketRanges that are used by 5 // StatisticsRecorder holds all Histograms and BucketRanges that are used by
6 // Histograms in the system. It provides a general place for 6 // Histograms in the system. It provides a general place for
7 // Histograms/BucketRanges to register, and supports a global API for accessing 7 // Histograms/BucketRanges to register, and supports a global API for accessing
8 // (i.e., dumping, or graphing) the data. 8 // (i.e., dumping, or graphing) the data.
9 9
10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ 10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // We keep all |bucket_ranges_| in a map, from checksum to a list of 78 // We keep all |bucket_ranges_| in a map, from checksum to a list of
79 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in 79 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in
80 // |bucket_ranges_|. 80 // |bucket_ranges_|.
81 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; 81 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap;
82 82
83 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; 83 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>;
84 friend class HistogramBaseTest; 84 friend class HistogramBaseTest;
85 friend class HistogramTest; 85 friend class HistogramTest;
86 friend class SparseHistogramTest; 86 friend class SparseHistogramTest;
87 friend class StatisticsRecorderTest; 87 friend class StatisticsRecorderTest;
88 FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest,
89 DeserializeHistogramAndAddSamples);
88 90
89 // The constructor just initializes static members. Usually client code should 91 // The constructor just initializes static members. Usually client code should
90 // use Initialize to do this. But in test code, you can friend this class and 92 // use Initialize to do this. But in test code, you can friend this class and
91 // call destructor/constructor to get a clean StatisticsRecorder. 93 // call destructor/constructor to get a clean StatisticsRecorder.
92 StatisticsRecorder(); 94 StatisticsRecorder();
93 ~StatisticsRecorder(); 95 ~StatisticsRecorder();
94 96
95 static void DumpHistogramsToVlog(void* instance); 97 static void DumpHistogramsToVlog(void* instance);
96 98
97 static HistogramMap* histograms_; 99 static HistogramMap* histograms_;
98 static RangesMap* ranges_; 100 static RangesMap* ranges_;
99 101
100 // Lock protects access to above maps. 102 // Lock protects access to above maps.
101 static base::Lock* lock_; 103 static base::Lock* lock_;
102 104
103 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 105 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
104 }; 106 };
105 107
106 } // namespace base 108 } // namespace base
107 109
108 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ 110 #endif // BASE_METRICS_STATISTICS_RECORDER_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram_delta_serialization_unittest.cc ('k') | content/browser/histogram_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698