ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
Benchmark.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include "cli/CLIOptions.hpp"
15#include "io/EvaluateResult.hpp"
16
17#include <nlohmann/json.hpp>
18#include <string>
19#include <vector>
20
21namespace CLI {
22 class App;
23}
24
25namespace ppforest2::cli {
27 void setup_benchmark(CLI::App& app, Params& params);
28
36 ScenarioResult() = default;
37
38 ScenarioResult(std::string name, double scenario_time_ms, nlohmann::json const& j)
39 : io::EvaluateResult(j)
40 , name(std::move(name))
42
43 std::string name;
44
45 // Scenario wall-clock time (including warmup + process overhead)
46 double scenario_time_ms = 0;
47 };
48
56 explicit BenchmarkSuite(std::string name = "ppforest2 benchmark")
57 : name(std::move(name)) {}
58
59 std::string name;
60 std::vector<nlohmann::json> scenarios;
61 };
62
66 struct SuiteResult {
67 SuiteResult() = default;
68 explicit SuiteResult(nlohmann::json const& j);
69
70 std::string suite_name;
71 std::string timestamp;
72 std::vector<ScenarioResult> results;
73 double total_time_ms = 0;
74
75 nlohmann::json to_json() const;
76 std::string to_csv() const;
77 };
78
83 BenchmarkSuite parse_suite(std::string const& path);
84
89 BenchmarkSuite parse_suite(nlohmann::json const& j);
90
103 SuiteResult run_suite(BenchmarkSuite const& suite, std::string const& binary_path, io::Output& out);
104
108 ScenarioResult run_scenario(nlohmann::json const& scenario, std::string const& binary_path);
109
116 int run_benchmark(Params const& params, std::string const& binary_path);
117}
CLI argument parsing, validation, and configuration for ppforest2.
Evaluation data types: per-iteration stats and run summaries.
Definition Benchmark.hpp:21
Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration.
Definition Benchmark.hpp:25
BenchmarkSuite parse_suite(std::string const &path)
Parse a BenchmarkSuite from a JSON file path.
void setup_benchmark(CLI::App &app, Params &params)
Register benchmark subcommand options on app.
ScenarioResult run_scenario(nlohmann::json const &scenario, std::string const &binary_path)
Run a single scenario as a subprocess.
int run_benchmark(Params const &params, std::string const &binary_path)
Run the benchmark subcommand.
SuiteResult run_suite(BenchmarkSuite const &suite, std::string const &binary_path, io::Output &out)
Run all scenarios in a suite via subprocess invocations.
Definition Color.hpp:31
A suite of scenarios with shared defaults.
Definition Benchmark.hpp:55
std::vector< nlohmann::json > scenarios
Definition Benchmark.hpp:60
std::string name
Definition Benchmark.hpp:59
BenchmarkSuite(std::string name="ppforest2 benchmark")
Definition Benchmark.hpp:56
All CLI options and runtime parameters.
Definition CLIOptions.hpp:33
Result of running a single benchmark scenario.
Definition Benchmark.hpp:35
double scenario_time_ms
Definition Benchmark.hpp:46
ScenarioResult(std::string name, double scenario_time_ms, nlohmann::json const &j)
Definition Benchmark.hpp:38
std::string name
Definition Benchmark.hpp:43
Aggregated results for an entire suite run.
Definition Benchmark.hpp:66
nlohmann::json to_json() const
SuiteResult(nlohmann::json const &j)
std::string timestamp
Definition Benchmark.hpp:71
double total_time_ms
Definition Benchmark.hpp:73
std::string to_csv() const
std::vector< ScenarioResult > results
Definition Benchmark.hpp:72
std::string suite_name
Definition Benchmark.hpp:70
Summary of an evaluation run.
Definition EvaluateResult.hpp:22
Quiet-aware, indentation-aware output context.
Definition Output.hpp:25