From f6e96861a373c90ea0c727177fc68d2984e048bb Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Sun, 17 Mar 2019 14:38:51 +0100 Subject: BENCHMARK_CAPTURE() and Complexity() - naming problem (#761) Created BenchmarkName class which holds the full benchmark name and allows specifying and retrieving different components of the name (e.g. ARGS, THREADS etc.) Fixes #730. --- include/benchmark/benchmark.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index e4f3921..2954ff4 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h @@ -1302,6 +1302,23 @@ struct SystemInfo { BENCHMARK_DISALLOW_COPY_AND_ASSIGN(SystemInfo); }; +// BenchmarkName contains the components of the Benchmark's name +// which allows individual fields to be modified or cleared before +// building the final name using 'str()'. +struct BenchmarkName { + std::string function_name; + std::string args; + std::string min_time; + std::string iterations; + std::string repetitions; + std::string time_type; + std::string threads; + + // Return the full name of the benchmark with each non-empty + // field separated by a '/' + std::string str() const; +}; + // Interface for custom benchmark result printers. // By default, benchmark reports are printed to stdout. However an application // can control the destination of the reports by calling @@ -1340,7 +1357,7 @@ class BenchmarkReporter { max_bytes_used(0) {} std::string benchmark_name() const; - std::string run_name; + BenchmarkName run_name; RunType run_type; // is this a measurement, or an aggregate? std::string aggregate_name; std::string report_label; // Empty if not set by benchmark. -- cgit v1.2.3