energy-bench

Crates.ioenergy-bench
lib.rsenergy-bench
version0.1.23
sourcesrc
created_at2024-05-06 08:38:28.868456
updated_at2024-11-08 11:23:35.349803
descriptionMethods for benchmarking the energy consumption of programs.
homepage
repositoryhttps://gitlab.com/software-energy-lab/energy-benchmarking
max_upload_size
id1230986
size57,503
Jordy Aaldering (JordyAaldering)

documentation

README

Energy Benchmarking Tool

Tool for benchmarking the energy consumption of programs. Idle energy consumption and energy consumed by data generation are not included in the results. A new benchmark builder is created with EnergyBenchBuilder::new(). A benchmark of function bench_fn with data data_fn can be started with benchmark(name, data_fn, bench_fn). This function returns a JSON of measurement data.

Check out the energy-benchmarking-example project for a minimal example.

use energy_bench::EnergyTool;

let bench = EnergyBenchBuilder::new("benchmark name").build();

bench.benchmark("instance name", data_fn, bench_fn);

Some programs are too short-running to provide accurate energy measurement results. To avoid this, the benchmark can be repeated until a given amount of time has passed: with_min_measurement_duration. By default, benchmarks are run for at least 100ms.

let bench = EnergyBenchBuilder::new("benchmark name")
    .with_min_measurement_duration(Duration::from_secs(2))
    .build();
Commit count: 263

cargo fmt