diff options
author | Werner Koch <wk@gnupg.org> | 2009-07-09 11:57:28 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-07-09 11:57:28 +0000 |
commit | 9b28e56d71d111416623988c7fa7c66dc6ab023c (patch) | |
tree | 2e3c1bac0638c6bbfcc8664e1dec649745785399 /tests/benchmark.c | |
parent | ab9ff33b9b55db3077af87bf321937e3fd9826c8 (diff) | |
download | libgcrypt-9b28e56d71d111416623988c7fa7c66dc6ab023c.tar.gz |
[random/ChangeLog]
* rndlinux.c (_gcry_rndlinux_gather_random): Print real values for
the progess function and call it before blocking. Suggested by
Christian Grothoff.
* rndunix.c (slow_poll): Add similar, but not yet functional, code.
SCALAR(0x81980e8)
Copyright 2008, 2009 Free Software Foundation, Inc.
[tests/ChangeLog]
* benchmark.c (progress_cb): New.
(main): Add option --progress.
Diffstat (limited to 'tests/benchmark.c')
-rw-r--r-- | tests/benchmark.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/benchmark.c b/tests/benchmark.c index 07509ae8..17199e50 100644 --- a/tests/benchmark.c +++ b/tests/benchmark.c @@ -340,6 +340,18 @@ elapsed_time (void) static void +progress_cb (void *cb_data, const char *what, int printchar, + int current, int total) +{ + (void)cb_data; + + fprintf (stderr, PGM ": progress (%s %c %d %d)\n", + what, printchar, current, total); + fflush (stderr); +} + + +static void random_bench (int very_strong) { char buf[128]; @@ -1002,6 +1014,7 @@ main( int argc, char **argv ) int last_argc = -1; int no_blinding = 0; int use_random_daemon = 0; + int with_progress = 0; if (argc) { argc--; argv++; } @@ -1056,6 +1069,11 @@ main( int argc, char **argv ) /* This command needs to be called before gcry_check_version. */ gcry_control (GCRYCTL_FORCE_FIPS_MODE, 0); } + else if (!strcmp (*argv, "--progress")) + { + argc--; argv++; + with_progress = 1; + } } gcry_control (GCRYCTL_SET_VERBOSITY, (int)verbose); @@ -1074,9 +1092,12 @@ main( int argc, char **argv ) if (use_random_daemon) gcry_control (GCRYCTL_USE_RANDOM_DAEMON, 1); + gcry_set_progress_handler (progress_cb, NULL); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + if (cipher_repetitions < 1) cipher_repetitions = 1; |