Chromium Code Reviews| Index: base/test/histogram_recorder.h |
| diff --git a/base/test/histogram_recorder.h b/base/test/histogram_recorder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..75d1d04e0e49d2d0556ae25d4092149ca81eafb9 |
| --- /dev/null |
| +++ b/base/test/histogram_recorder.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TEST_HISTOGRAM_RECORDER_H_ |
| +#define BASE_TEST_HISTOGRAM_RECORDER_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/metrics/histogram_samples.h" |
| + |
| +namespace base { |
| + |
| +// This class acts as a differential reader for histogram samples, enabling |
| +// 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
|
| +class HistogramRecorder { |
| + public: |
| + // Initializes the HistogramRecorder system. |
| + static void Initialize(); |
| + HistogramRecorder(); |
| + virtual ~HistogramRecorder(); |
| + |
| + // Returns whether the HistogramRecorder has been initialized. |
| + static bool IsActive(); |
| + |
| + // Returns the histogram data accumulated since this instance was created. |
| + // Returns NULL if no samples are available. |
| + scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation( |
| + const std::string& histogram_name); |
| + |
| + private: |
| + // Used to determine the histogram changes made during this instance's |
| + // lifecycle. |
|
ppi
2013/12/19 16:57:27
Could we clarify the ownership of HistogramSamples
lpromero
2013/12/20 11:53:44
Done.
|
| + 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.
|
| +}; |
| + |
| +} // namespace base |
| + |
| +#endif // BASE_TEST_HISTOGRAM_RECORDER_H_ |