1919
2020#define POINTS 32768
2121
22- static void help (char * * argv ) {
22+ static void help (char * * argv , int default_iters ) {
2323 printf ("Benchmark EC multiplication algorithms\n" );
2424 printf ("\n" );
25+ printf ("The default number of iterations for each benchmark is %d. This can be\n" , default_iters );
26+ printf ("customized using the SECP256K1_BENCH_ITERS environment variable.\n" );
27+ printf ("\n" );
2528 printf ("Usage: %s <help|pippenger_wnaf|strauss_wnaf|simple>\n" , argv [0 ]);
2629 printf ("The output shows the number of multiplied and summed points right after the\n" );
2730 printf ("function name. The letter 'g' indicates that one of the points is the generator.\n" );
@@ -308,15 +311,16 @@ int main(int argc, char **argv) {
308311 int i , p ;
309312 size_t scratch_size ;
310313
311- int iters = get_iters (10000 );
314+ int default_iters = 10000 ;
315+ int iters = get_iters (default_iters );
312316
313317 data .ecmult_multi = secp256k1_ecmult_multi_var ;
314318
315319 if (argc > 1 ) {
316320 if (have_flag (argc , argv , "-h" )
317321 || have_flag (argc , argv , "--help" )
318322 || have_flag (argc , argv , "help" )) {
319- help (argv );
323+ help (argv , default_iters );
320324 return EXIT_SUCCESS ;
321325 } else if (have_flag (argc , argv , "pippenger_wnaf" )) {
322326 printf ("Using pippenger_wnaf:\n" );
@@ -328,7 +332,7 @@ int main(int argc, char **argv) {
328332 printf ("Using simple algorithm:\n" );
329333 } else {
330334 fprintf (stderr , "%s: unrecognized argument '%s'.\n\n" , argv [0 ], argv [1 ]);
331- help (argv );
335+ help (argv , default_iters );
332336 return EXIT_FAILURE ;
333337 }
334338 }
@@ -381,6 +385,8 @@ int main(int argc, char **argv) {
381385 run_ecmult_multi_bench (& data , i << p , 1 , iters );
382386 }
383387 }
388+ } else {
389+ printf ("Skipping some benchmarks due to SECP256K1_BENCH_ITERS <= 2:\n" );
384390 }
385391
386392 if (data .scratch != NULL ) {
0 commit comments