From: cheloha Date: Fri, 13 Jul 2018 18:36:56 +0000 (+0000) Subject: openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f5e75c9e17070722045734a5d1e7301748e8c79a;p=openbsd openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET Much more apt than the current operation names. Names suggested by jca@ ages ago. ok jca, jsing --- diff --git a/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h index d02169b8aaf..cfc6036ccfb 100644 --- a/usr.bin/openssl/apps.h +++ b/usr.bin/openssl/apps.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.h,v 1.20 2017/12/05 15:02:06 jca Exp $ */ +/* $OpenBSD: apps.h,v 1.21 2018/07/13 18:36:56 cheloha Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -277,10 +277,10 @@ unsigned char *next_protos_parse(unsigned short *outlen, const char *in); int app_isdir(const char *); -#define TM_START 0 -#define TM_STOP 1 -double app_timer_real(int stop); -double app_timer_user(int stop); +#define TM_RESET 0 +#define TM_GET 1 +double app_timer_real(int); +double app_timer_user(int); #define OPENSSL_NO_SSL_INTERN diff --git a/usr.bin/openssl/apps_posix.c b/usr.bin/openssl/apps_posix.c index 502919c0a2a..cdcf8213663 100644 --- a/usr.bin/openssl/apps_posix.c +++ b/usr.bin/openssl/apps_posix.c @@ -124,13 +124,13 @@ #include "apps.h" double -app_timer_real(int stop) +app_timer_real(int get) { static struct timespec start; struct timespec elapsed, now; clock_gettime(CLOCK_MONOTONIC, &now); - if (stop) { + if (get) { timespecsub(&now, &start, &elapsed); return elapsed.tv_sec + elapsed.tv_nsec / 1000000000.0; } @@ -139,14 +139,14 @@ app_timer_real(int stop) } double -app_timer_user(int stop) +app_timer_user(int get) { static struct timeval start; struct timeval elapsed; struct rusage now; getrusage(RUSAGE_SELF, &now); - if (stop) { + if (get) { timersub(&now.ru_utime, &start, &elapsed); return elapsed.tv_sec + elapsed.tv_usec / 1000000.0; } diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c index ed89160b23d..0d0b7712819 100644 --- a/usr.bin/openssl/s_time.c +++ b/usr.bin/openssl/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.23 2018/02/07 05:47:55 jsing Exp $ */ +/* $OpenBSD: s_time.c,v 1.24 2018/07/13 18:36:56 cheloha Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -228,8 +228,8 @@ s_time_usage(void) /*********************************************************************** * TIME - time functions */ -#define START 0 -#define STOP 1 +#define START TM_RESET +#define STOP TM_GET static double tm_Time_F(int op) diff --git a/usr.bin/openssl/speed.c b/usr.bin/openssl/speed.c index a21f67b5cfe..3d226a204e2 100644 --- a/usr.bin/openssl/speed.c +++ b/usr.bin/openssl/speed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: speed.c,v 1.22 2018/02/07 05:47:55 jsing Exp $ */ +/* $OpenBSD: speed.c,v 1.23 2018/07/13 18:36:56 cheloha Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -195,8 +195,8 @@ sig_done(int sig) run = 0; } -#define START 0 -#define STOP 1 +#define START TM_RESET +#define STOP TM_GET static double