15 int Benchmark::CountLaunches()
const
20 void Benchmark::Launch(
int& current,
int total, LauncherHandler& handler)
27 _settings._params.emplace_back(-1, -1, -1);
33 Context context(std::get<0>(param), std::get<1>(param), std::get<2>(param));
41 context._current->InitLatencyHistogram(latency_params);
44 handler.onLaunching(++current, total, *
this, context, attempt);
53 uint64_t timestamp = 0;
59 uint64_t timespan = 0;
62 for (; timespan < 1000000000; ++count)
73 operations = (1000000000ull * count * duration) / timespan;
76 context._current->StartCollectingMetrics();
77 while (!context.canceled() && (infinite || (operations > 0)))
80 context._metrics->AddOperations(1);
96 context._current->StopCollectingMetrics();
102 handler.onLaunched(current, total, *
this, context, attempt);
bool _launched
Benchmark launched flag.
Settings _settings
Benchmark settings.
static void UpdateBenchmarkNames(std::vector< std::shared_ptr< PhaseCore >> &phases)
Update benchmark names for the given benchmark phases collection.
void InitBenchmarkContext(Context &context)
Initialize benchmark context.
static void UpdateBenchmarkThreads(std::vector< std::shared_ptr< PhaseCore >> &phases)
Update benchmark threads metrics for the given benchmark phases collection.
static void UpdateBenchmarkMetrics(std::vector< std::shared_ptr< PhaseCore >> &phases)
Update benchmark metrics for the given benchmark phases collection.
std::vector< std::shared_ptr< PhaseCore > > _phases
Benchmark phases.
virtual void Run(Context &context)=0
Benchmark run method.
virtual void Initialize(Context &context)
Initialize benchmark.
virtual void Cleanup(Context &context)
Cleanup benchmark.
const std::vector< std::tuple< int, int, int > > & params() const noexcept
Get collection of independent parameters in a benchmark plan.
int attempts() const noexcept
Get count of independent benchmark attempts.
int64_t duration() const noexcept
Get benchmark duration in milliseconds.
bool infinite() const noexcept
Is benchmark running with infinite count of operations (until cancel)?
const std::tuple< int64_t, int64_t, int > & latency() const noexcept
Get latency parameters.
int64_t operations() const noexcept
Get count of operations.
bool latency_auto() const noexcept
Get automatic latency update flag.
static uint64_t Timestamp()
Get the current timestamp in nanoseconds.
Launcher handler definition.
C++ Benchmark project definitions.