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/memory/scoped_ptr.h" | |
| 11 #include "base/metrics/histogram_samples.h" | |
| 12 | |
| 13 namespace base { | |
| 14 | |
| 15 // This class acts as a differential reader for histogram samples, enabling | |
| 16 // tests to check that metrics were sent as they should be. | |
|
ppi
2013/12/19 16:57:27
Should we say "recorded" instead of "sent"? Am I c
lpromero
2013/12/20 11:53:44
Yes, you are correct. By sent, I meant triggered f
| |
| 17 class HistogramRecorder { | |
| 18 public: | |
| 19 // Initializes the HistogramRecorder system. | |
| 20 static void Initialize(); | |
| 21 HistogramRecorder(); | |
| 22 virtual ~HistogramRecorder(); | |
| 23 | |
| 24 // Returns whether the HistogramRecorder has been initialized. | |
| 25 static bool IsActive(); | |
| 26 | |
| 27 // Returns the histogram data accumulated since this instance was created. | |
| 28 // Returns NULL if no samples are available. | |
| 29 scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation( | |
| 30 const std::string& histogram_name); | |
| 31 | |
| 32 private: | |
| 33 // Used to determine the histogram changes made during this instance's | |
| 34 // lifecycle. | |
|
ppi
2013/12/19 16:57:27
Could we clarify the ownership of HistogramSamples
lpromero
2013/12/20 11:53:44
Done.
| |
| 35 std::map<std::string, HistogramSamples*> original_samples_; | |
|
ppi
2013/12/19 16:57:27
DISALLOW_COPY_AND_ASSIGN(HistogramRecorder);
lpromero
2013/12/20 11:53:44
Done.
| |
| 36 }; | |
| 37 | |
| 38 } // namespace base | |
| 39 | |
| 40 #endif // BASE_TEST_HISTOGRAM_RECORDER_H_ | |
| OLD | NEW |