Thin wrapper around the Criterion benchmark suite. This library is intended to be used as both a simple means of generating benchmark data for the Chromeperf dashboard, but also for local benchmarking with Criterion.
When generating Fuchsia benchmarking results (
FuchsiaCriterion::default), the main function where this constructor is called will expect an output JSON path where it will store the results according to the Fuchsia benchmarking schema.
See examples/main.rs for an example of how to use the FuchsiaCriterion library to benchmark Fuchsia targets.
Note that this example runs the benchmarks in an emulator, which results in highly variable performance data that should be treated only as a rough approximation at best. Integrating the benchmarks with Chromeperf will allow for precise results against specific devices, and enable performance comparisons via the perfcompare tool.
Add the criterion_bench target to your
fx set line:
fx set <product>.<board> --with //src/developer/fuchsia-criterion:criterion_bench
Start the Fuchsia emulator:
ffx emu start --headless
In a separate terminal, serve Fuchsia packages:
fx serve -v
Connect to the emulator shell, and run the benchmarks, storing the output in
fx shell criterion_bench /tmp/criterion_bench_results.fuchsiaperf.json
By default, the FuchsiaCriterion library will only output a fuchsiaperf.json file. However, adding
--args=local_bench='true' to your fx set line (e.g. Step 1, above) overrides that behavior so that FuchsiaCriterion provides the command line interface from the upstream Criterion library. This allows you to replace Step 5 above with
fx shell criterion_bench, and directly stream the benchmark output to console.