Make bench support selecting which benchmarks to run

This commit is contained in:
Pieter Wuille
2021-11-05 17:48:18 -04:00
parent 9f56bdf5b9
commit af6abcb3d0
4 changed files with 17 additions and 13 deletions

View File

@@ -42,13 +42,14 @@ static void bench_ecdh(void* arg, int iters) {
}
}
void run_ecdh_bench(int iters) {
void run_ecdh_bench(int iters, int argc, char** argv) {
bench_ecdh_data data;
int d = argc == 1;
/* create a context with no capabilities */
data.ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT);
run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, iters);
if (d || have_flag(argc, argv, "ecdh")) run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, iters);
secp256k1_context_destroy(data.ctx);
}