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

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

Issue 18337014: Add a HistogramRecorder class and use cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove an empty line. Created 7 years, 5 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
« no previous file with comments | « base/base.gyp ('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/metrics/histogram_samples.h"
11
12 namespace base {
13
14 // This class acts as a differential reader for histogram samples, enabling
15 // tests to check that metrics were sent as they should be.
16 class HistogramRecorder {
17 public:
18 // Constructor takes a histogram prefix.
blundell 2013/07/10 14:35:36 Instead of this comment, have a comment explaining
lpromero 2013/07/10 17:08:33 Done.
19 explicit HistogramRecorder(const std::string& prefix);
20 virtual ~HistogramRecorder();
21
22 // Returns the histogram data accumulated since this instance was created.
23 // The returned pointer is owned by the HistogramRecorder instance and cannot
24 // be used after that instance is destroyed.
25 // Returns NULL if no samples are available.
26 HistogramSamples* GetHistogramSamples(const std::string& histogram_name);
blundell 2013/07/10 14:35:36 I think this would be more clear as GetHistogramSa
lpromero 2013/07/10 17:08:33 Done.
27
28 private:
29 // Used to determine the histogram changes made during this instance's
30 // lifecycle.
31 std::map<std::string, HistogramSamples*> original_samples_;
32 std::map<std::string, HistogramSamples*> samples_;
33 };
34
35 } // namespace base
36
37 #endif // BASE_TEST_HISTOGRAM_RECORDER_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/test/histogram_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698