mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-22 05:35:46 +00:00
Use CLOCK_MONOTONIC instead of the non-standard CLOCK_MONOTONIC_PRECISE.
Use librt if required for clock_gettime(2).
This commit is contained in:
parent
75ee849080
commit
37973b8705
9 changed files with 18 additions and 17 deletions
|
@ -8,7 +8,8 @@ check_LTLIBRARIES = libt.la
|
|||
libt_la_SOURCES = t_main.c t_file.c t_util.c t_const.c t_malloc.c
|
||||
|
||||
# Link in the test driver and the full cryb library
|
||||
LDADD = $(builddir)/libt.la \
|
||||
LDADD = ${RT_LIBS} \
|
||||
$(builddir)/libt.la \
|
||||
$(top_builddir)/lib/core/libcryb-core.la \
|
||||
$(top_builddir)/lib/enc/libcryb-enc.la \
|
||||
$(top_builddir)/lib/digest/libcryb-digest.la \
|
||||
|
|
|
@ -179,10 +179,10 @@ t_md2_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_md2_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -195,10 +195,10 @@ t_md4_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_md4_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -195,10 +195,10 @@ t_md5_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_md5_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -191,10 +191,10 @@ t_sha1_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_sha1_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -200,10 +200,10 @@ t_sha224_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_sha224_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -196,10 +196,10 @@ t_sha256_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_sha256_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -212,10 +212,10 @@ t_sha384_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_sha384_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
|
@ -222,10 +222,10 @@ t_sha512_perf(char **desc, void *arg)
|
|||
|
||||
if ((msg = calloc(1, msglen)) == NULL)
|
||||
err(1, "calloc()");
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
for (int i = 0; i < T_PERF_ITERATIONS; ++i)
|
||||
t_sha512_complete(msg, msglen, digest);
|
||||
clock_gettime(CLOCK_MONOTONIC_PRECISE, &te);
|
||||
clock_gettime(CLOCK_MONOTONIC, &te);
|
||||
free(msg);
|
||||
ns = te.tv_sec * 1000000000LU + te.tv_nsec;
|
||||
ns -= ts.tv_sec * 1000000000LU + ts.tv_nsec;
|
||||
|
|
Loading…
Reference in a new issue