Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_ | |
| OLD | NEW |