Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "util.h"
#include "bench.h"

static void help(int default_iters) {
static void help(const char *executable_path, int default_iters) {
printf("Benchmarks the following algorithms:\n");
printf(" - ECDSA signing/verification\n");

Expand All @@ -36,7 +36,7 @@ static void help(int default_iters) {
printf("The default number of iterations for each benchmark is %d. This can be\n", default_iters);
printf("customized using the SECP256K1_BENCH_ITERS environment variable.\n");
printf("\n");
printf("Usage: ./bench [args]\n");
printf("Usage: %s [args]\n", executable_path);
printf("By default, all benchmarks will be run.\n");
printf("args:\n");
printf(" help : display this help and exit\n");
Expand Down Expand Up @@ -189,19 +189,19 @@ int main(int argc, char** argv) {
int default_iters = 20000;
int iters = get_iters(default_iters);
if (iters == 0) {
help(default_iters);
help(argv[0], default_iters);
return EXIT_FAILURE;
}

if (argc > 1) {
if (have_flag(argc, argv, "-h")
|| have_flag(argc, argv, "--help")
|| have_flag(argc, argv, "help")) {
help(default_iters);
help(argv[0], default_iters);
return EXIT_SUCCESS;
} else if (invalid_args) {
fprintf(stderr, "./bench: unrecognized argument.\n\n");
help(default_iters);
help(argv[0], default_iters);
return EXIT_FAILURE;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/bench_ecmult.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

#define POINTS 32768

static void help(char **argv, int default_iters) {
static void help(const char *executable_path, int default_iters) {
printf("Benchmark EC multiplication algorithms\n");
printf("\n");
printf("The default number of iterations for each benchmark is %d. This can be\n", default_iters);
printf("customized using the SECP256K1_BENCH_ITERS environment variable.\n");
printf("\n");
printf("Usage: %s <help|pippenger_wnaf|strauss_wnaf|simple>\n", argv[0]);
printf("Usage: %s [args]\n", executable_path);
printf("The output shows the number of multiplied and summed points right after the\n");
printf("function name. The letter 'g' indicates that one of the points is the generator.\n");
printf("The benchmarks are divided by the number of points.\n");
Expand Down Expand Up @@ -314,7 +314,7 @@ int main(int argc, char **argv) {
int default_iters = 10000;
int iters = get_iters(default_iters);
if (iters == 0) {
help(argv, default_iters);
help(argv[0], default_iters);
return EXIT_FAILURE;
}

Expand All @@ -324,7 +324,7 @@ int main(int argc, char **argv) {
if(have_flag(argc, argv, "-h")
|| have_flag(argc, argv, "--help")
|| have_flag(argc, argv, "help")) {
help(argv, default_iters);
help(argv[0], default_iters);
return EXIT_SUCCESS;
} else if(have_flag(argc, argv, "pippenger_wnaf")) {
printf("Using pippenger_wnaf:\n");
Expand All @@ -336,7 +336,7 @@ int main(int argc, char **argv) {
printf("Using simple algorithm:\n");
} else {
fprintf(stderr, "%s: unrecognized argument '%s'.\n\n", argv[0], argv[1]);
help(argv, default_iters);
help(argv[0], default_iters);
return EXIT_FAILURE;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/bench_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
#include "ecmult_impl.h"
#include "bench.h"

static void help(int default_iters) {
static void help(const char *executable_path, int default_iters) {
printf("Benchmarks various internal routines.\n");
printf("\n");
printf("The default number of iterations for each benchmark is %d. This can be\n", default_iters);
printf("customized using the SECP256K1_BENCH_ITERS environment variable.\n");
printf("\n");
printf("Usage: ./bench_internal [args]\n");
printf("Usage: %s [args]\n", executable_path);
printf("By default, all benchmarks will be run.\n");
printf("args:\n");
printf(" help : display this help and exit\n");
Expand Down Expand Up @@ -389,15 +389,15 @@ int main(int argc, char **argv) {
int default_iters = 20000;
int iters = get_iters(default_iters);
if (iters == 0) {
help(default_iters);
help(argv[0], default_iters);
return EXIT_FAILURE;
}

if (argc > 1) {
if (have_flag(argc, argv, "-h")
|| have_flag(argc, argv, "--help")
|| have_flag(argc, argv, "help")) {
help(default_iters);
help(argv[0], default_iters);
return EXIT_SUCCESS;
}
}
Expand Down