CppBenchmark
1.0.4.0
C++ Benchmark Library
|
CppBenchmark definitions. More...
#include "benchmark/executor.h"
#include "benchmark/launcher_console.h"
#include "benchmark/reporter_console.h"
#include "benchmark/reporter_csv.h"
#include "benchmark/reporter_json.h"
Go to the source code of this file.
Namespaces | |
CppBenchmark | |
C++ Benchmark project definitions. | |
Macros | |
#define | BENCHMARK_MAIN() |
Benchmark main entry point macro. More... | |
#define | BENCHMARK(...) |
Benchmark register macro. More... | |
#define | BENCHMARK_FIXTURE(fixture, ...) |
Benchmark with fixture register macro. More... | |
#define | BENCHMARK_THREADS(...) |
Benchmark threads register macro. More... | |
#define | BENCHMARK_THREADS_FIXTURE(fixture, ...) |
Benchmark threads with fixture register macro. More... | |
#define | BENCHMARK_CLASS(type, ...) namespace CppBenchmark { Internals::BenchmarkRegistrator BENCHMARK_INTERNAL_UNIQUE_NAME(benchmark_registrator)([]() { return std::make_shared<type>(__VA_ARGS__); }); } |
Benchmark class register macro. More... | |
#define | BENCHCODE_SCOPE(name) CppBenchmark::Executor::ScopeBenchmark(name); |
Dynamic benchmark scope register macro. More... | |
#define | BENCHCODE_START(name) CppBenchmark::Executor::StartBenchmark(name); |
Dynamic benchmark start macro. More... | |
#define | BENCHCODE_STOP(name) CppBenchmark::Executor::StopBenchmark(name); |
Dynamic benchmark stop macro. More... | |
#define | BENCHCODE_REPORT() |
Dynamic benchmarks report to console macro. More... | |
#define | BENCHCODE_REPORT_STR(value) |
Dynamic benchmarks report as a string macro. More... | |
#define | BENCHCODE_REPORT_CSV(value) |
Dynamic benchmarks report as a CSV format string macro. More... | |
#define | BENCHCODE_REPORT_JSON(value) |
Dynamic benchmarks report as a JSON format string macro. More... | |
#define BENCHCODE_REPORT | ( | ) |
Dynamic benchmarks report to console macro.
Prepare results of all dynamic benchmarks registered in static Executor class and show them using ReporterConsole.
Example:
Definition at line 331 of file cppbenchmark.h.
#define BENCHCODE_REPORT_CSV | ( | value | ) |
Dynamic benchmarks report as a CSV format string macro.
Prepare results of all dynamic benchmarks registered in static Executor class using ReporterCSV and store them in a string variable value.
Example:
Definition at line 369 of file cppbenchmark.h.
#define BENCHCODE_REPORT_JSON | ( | value | ) |
Dynamic benchmarks report as a JSON format string macro.
Prepare results of all dynamic benchmarks registered in static Executor class using ReporterJSON and store them in a string variable value.
Example:
Definition at line 389 of file cppbenchmark.h.
#define BENCHCODE_REPORT_STR | ( | value | ) |
Dynamic benchmarks report as a string macro.
Prepare results of all dynamic benchmarks registered in static Executor class using ReporterConsole and store them in a string variable value.
Example:
Definition at line 349 of file cppbenchmark.h.
#define BENCHCODE_SCOPE | ( | name | ) | CppBenchmark::Executor::ScopeBenchmark(name); |
Dynamic benchmark scope register macro.
Create a scope guard for dynamic benchmark with the given name. It will be automatically registered in static Executor class.
Example:
Definition at line 277 of file cppbenchmark.h.
#define BENCHCODE_START | ( | name | ) | CppBenchmark::Executor::StartBenchmark(name); |
Dynamic benchmark start macro.
Start dynamic benchmark with the given name. It will be automatically registered in static Executor class. Should be used in pair with BENCHCODE_STOP macro!
Example:
Definition at line 294 of file cppbenchmark.h.
#define BENCHCODE_STOP | ( | name | ) | CppBenchmark::Executor::StopBenchmark(name); |
Dynamic benchmark stop macro.
Stop dynamic benchmark with the given name. It will be automatically registered in static Executor class. Should be used in pair with BENCHCODE_START macro!
Example:
Definition at line 311 of file cppbenchmark.h.
#define BENCHMARK | ( | ... | ) |
Benchmark register macro.
Register a new benchmark with a given name and settings. Next to the definition you should provide a benchmark code.
Example:
Definition at line 68 of file cppbenchmark.h.
#define BENCHMARK_CLASS | ( | type, | |
... | |||
) | namespace CppBenchmark { Internals::BenchmarkRegistrator BENCHMARK_INTERNAL_UNIQUE_NAME(benchmark_registrator)([]() { return std::make_shared<type>(__VA_ARGS__); }); } |
Benchmark class register macro.
Register a new benchmark based on a child class of a type with a given name and settings. You should inherit type from Benchmark, BenchmarkThreads or BenchmarkPC and implement all necessary benchmark methods.
Example:
Definition at line 258 of file cppbenchmark.h.
#define BENCHMARK_FIXTURE | ( | fixture, | |
... | |||
) |
Benchmark with fixture register macro.
Register a new benchmark with a given fixture, name and settings. Next to the definition you should provide a benchmark code. In benchmark code you can access to public and protected fields and methods of the fixture.
Benchmark static fixture is a user class that will be constructed before benchmarking and will be destructed after.
Static fixture example:
Benchmark dynamic fixture is a user class inherited from Fixture base class and overrides Initialize()/Cleanup() methods that will be called before/after each benchmark attempt.
Dynamic fixture example:
Definition at line 128 of file cppbenchmark.h.
#define BENCHMARK_MAIN | ( | ) |
Benchmark main entry point macro.
Main entry point definition for all benchmarks. Place this macro in some .cpp file to provide a main() function with registered LauncherConsole with argc & argv arguments parsing.
Definition at line 46 of file cppbenchmark.h.
#define BENCHMARK_THREADS | ( | ... | ) |
Benchmark threads register macro.
Register a new threads benchmark with a given name and settings. Next to the definition you should provide a benchmark code that will be executed in multi-thread environment. You can use settings parameter to give threads count you want to measure with.
Example:
Definition at line 156 of file cppbenchmark.h.
#define BENCHMARK_THREADS_FIXTURE | ( | fixture, | |
... | |||
) |
Benchmark threads with fixture register macro.
Register a new threads benchmark with a given fixture, name and settings. Next to the definition you should provide a benchmark code that will be executed in multi-thread environment. In benchmark code you can access to public and protected fields & methods of the fixture. You can use settings parameter to give threads count you want to measure with.
Benchmark static threads fixture is a user class that will be constructed before benchmarking and destructed after.
Static threads fixture example:
Benchmark dynamic threads fixture is a user class inherited from Fixture or FixtureThreads base class and overrides Initialize()/Cleanup()/InitializeThread()/CleanupThread() methods that will be called before/after each benchmark attempt and before/after each thread is started/finished.
Dynamic threads fixture example:
Definition at line 224 of file cppbenchmark.h.