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

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

Issue 19866004: Reland "Add a HistogramRecorder class and use cases." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix an English error. 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
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | base/test/histogram_recorder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
18 class HistogramRecorder {
19 public:
20 // Initializes the HistogramRecorder system.
21 static void Initialize();
Mark Mentovai 2013/12/20 18:07:12 This shouldn’t precede the constructor. http://goo
lpromero 2013/12/20 18:22:42 Done.
22 HistogramRecorder();
23 virtual ~HistogramRecorder();
Mark Mentovai 2013/12/20 18:07:12 Why is this virtual? There are no other virtual me
lpromero 2013/12/20 18:22:42 Done.
24
25 // Returns whether the HistogramRecorder has been initialized.
26 static bool IsActive();
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_;
Mark Mentovai 2013/12/20 18:07:12 Include what you use: #include <string>
lpromero 2013/12/20 18:22:42 Done.
38
39 DISALLOW_COPY_AND_ASSIGN(HistogramRecorder);
40 };
41
42 } // namespace base
43
44 #endif // BASE_TEST_HISTOGRAM_RECORDER_H_
OLDNEW
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | base/test/histogram_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698