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

Side by Side Diff: base/test/histogram_recorder.h

Issue 120753002: Add a StatisticsDeltaReader class and use cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_HISTOGRAM_RECORDER_H_
6 #define BASE_TEST_HISTOGRAM_RECORDER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram_samples.h"
13
14 namespace base {
15
16 // This class acts as a differential reader for histogram samples, enabling
17 // tests to check that metrics were recorded as they should be.
ppi 2013/12/23 16:37:48 I suggest: "This class acts as a differential rea
18 class HistogramRecorder {
ppi 2013/12/23 16:37:48 Let's rename it to HistogramDeltaReader ?
19 public:
20 // Initializes the HistogramRecorder system.
21 static void Initialize();
ppi 2013/12/23 16:37:48 Clients can call StatisticsRecorder::Initialize()
22 HistogramRecorder();
23 virtual ~HistogramRecorder();
24
25 // Returns whether the HistogramRecorder has been initialized.
26 static bool IsActive();
ppi 2013/12/23 16:37:48 What do we need that for? See also the comment abo
27
28 // Returns the histogram data accumulated since this instance was created.
29 // Returns NULL if no samples are available.
30 scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation(
31 const std::string& histogram_name);
32
33 private:
34 // Used to determine the histogram changes made during this instance's
35 // lifecycle. This isntance takes ownership of the samples, which are deleted
36 // when the instance is destroyed.
37 std::map<std::string, HistogramSamples*> original_samples_;
38
39 DISALLOW_COPY_AND_ASSIGN(HistogramRecorder);
40 };
41
42 } // namespace base
43
44 #endif // BASE_TEST_HISTOGRAM_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698