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/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(); | |
| 22 HistogramRecorder(); | |
| 23 virtual ~HistogramRecorder(); | |
| 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, that are deleted | |
|
blundell
2013/12/20 12:29:38
instance
blundell
2013/12/20 12:29:38
s/that/which
lpromero
2013/12/20 12:37:50
Done.
| |
| 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_ | |
| OLD | NEW |