diff options
author | Simon Josefsson <simon@josefsson.org> | 2010-02-18 10:25:23 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2010-02-18 10:25:23 +0100 |
commit | 1f71576c44bdbabd6c2783fc31d8fc4bfda816ad (patch) | |
tree | 38765dd9f764277a9c50984d42b894d65da1a476 | |
parent | f5ad38187df68e3f44faed98abedeac689244b50 (diff) | |
download | gnutls-1f71576c44bdbabd6c2783fc31d8fc4bfda816ad.tar.gz |
Use gnulib gettime module. Indent.
-rw-r--r-- | src/benchmark.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/benchmark.c b/src/benchmark.c index b54a866d61..0fe47dc4af 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -28,6 +28,7 @@ #include <gnutls/gnutls.h> #include <gnutls/crypto.h> #include <time.h> +#include "timespec.h" /* gnulib gettime */ static unsigned char data[64 * 1024]; @@ -68,7 +69,7 @@ cipher_bench (int algo, int size) printf ("Checking %s (%dkb payload)... ", gnutls_cipher_get_name (algo), size); fflush (stdout); - clock_gettime (CLOCK_MONOTONIC, &start); + gettime (&start); ret = gnutls_cipher_init (&ctx, algo, &key, &iv); if (ret < 0) @@ -85,11 +86,10 @@ cipher_bench (int algo, int size) gnutls_cipher_deinit (ctx); - clock_gettime (CLOCK_MONOTONIC, &stop); + gettime (&stop); - secs = - (stop.tv_sec * 1000 + stop.tv_nsec / (1000 * 1000) - - (start.tv_sec * 1000 + start.tv_nsec / (1000 * 1000))); + secs = (stop.tv_sec * 1000 + stop.tv_nsec / (1000 * 1000) - + (start.tv_sec * 1000 + start.tv_nsec / (1000 * 1000))); secs /= 1000; dd = (((double) data_size / (double) secs)) / 1000; printf ("Encrypted %ld kb in %.2f secs: ", data_size / 1000, secs); @@ -121,7 +121,7 @@ mac_bench (int algo, int size) printf ("Checking %s (%dkb payload)... ", gnutls_mac_get_name (algo), size); fflush (stdout); - clock_gettime (CLOCK_MONOTONIC, &start); + gettime (&start); for (i = 0; i < TOTAL_ITER; i++) { @@ -129,7 +129,7 @@ mac_bench (int algo, int size) data_size += size * 1024; } - clock_gettime (CLOCK_MONOTONIC, &stop); + gettime (&stop); secs = (stop.tv_sec * 1000 + stop.tv_nsec / (1000 * 1000) - @@ -140,7 +140,6 @@ mac_bench (int algo, int size) printf ("%.2f kbyte/sec\n", dd); free (_key); - } int |