aboutsummaryrefslogtreecommitdiff
path: root/include/benchmark
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-03-17 16:16:36 -0400
committerEric Fiselier <eric@efcs.ca>2015-03-17 16:16:36 -0400
commit20f1c0e2a8e692076dd7a5586f73ab8e2d726c12 (patch)
tree974271d3be0bb69bb4857c5a5f6501fdf8b08f3c /include/benchmark
parentb260cf76989388e9421fad268567af6964ca319b (diff)
downloadgoogle-benchmark-20f1c0e2a8e692076dd7a5586f73ab8e2d726c12.tar.gz
Apply reporter interface changes. Make report methods non-const and add a Finalize method.
Diffstat (limited to 'include/benchmark')
-rw-r--r--include/benchmark/benchmark_api.h2
-rw-r--r--include/benchmark/reporter.h18
2 files changed, 12 insertions, 8 deletions
diff --git a/include/benchmark/benchmark_api.h b/include/benchmark/benchmark_api.h
index 78a9210..41b8b4f 100644
--- a/include/benchmark/benchmark_api.h
+++ b/include/benchmark/benchmark_api.h
@@ -149,7 +149,7 @@ void Initialize(int* argc, const char** argv);
// Otherwise, run all benchmarks specified by the --benchmark_filter flag,
// and exit after running the benchmarks.
void RunSpecifiedBenchmarks();
-void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter);
+void RunSpecifiedBenchmarks(BenchmarkReporter* reporter);
// If this routine is called, peak memory allocation past this point in the
// benchmark is reported at the end of the benchmark report line. (It is
diff --git a/include/benchmark/reporter.h b/include/benchmark/reporter.h
index 66dc6dd..b66854c 100644
--- a/include/benchmark/reporter.h
+++ b/include/benchmark/reporter.h
@@ -67,13 +67,17 @@ class BenchmarkReporter {
// platform under which the benchmarks are running. The benchmark run is
// never started if this function returns false, allowing the reporter
// to skip runs based on the context information.
- virtual bool ReportContext(const Context& context) const = 0;
+ virtual bool ReportContext(const Context& context) = 0;
// Called once for each group of benchmark runs, gives information about
// cpu-time and heap memory usage during the benchmark run.
// Note that all the grouped benchmark runs should refer to the same
// benchmark, thus have the same name.
- virtual void ReportRuns(const std::vector<Run>& report) const = 0;
+ virtual void ReportRuns(const std::vector<Run>& report) = 0;
+
+ // Called once and only once after ever group of benchmarks is run and
+ // reported.
+ virtual void Finalize();
virtual ~BenchmarkReporter();
};
@@ -82,12 +86,12 @@ class BenchmarkReporter {
// default reporter used by RunSpecifiedBenchmarks().
class ConsoleReporter : public BenchmarkReporter {
public:
- virtual bool ReportContext(const Context& context) const;
- virtual void ReportRuns(const std::vector<Run>& reports) const;
+ virtual bool ReportContext(const Context& context);
+ virtual void ReportRuns(const std::vector<Run>& reports);
private:
- virtual void PrintRunData(const Run& report) const;
- // TODO(ericwf): Find a better way to share this information.
- mutable size_t name_field_width_;
+ virtual void PrintRunData(const Run& report);
+
+ size_t name_field_width_;
};
} // end namespace benchmark