diff options
author | jca <> | 2017-12-05 15:02:06 +0000 |
---|---|---|
committer | jca <> | 2017-12-05 15:02:06 +0000 |
commit | bfd05667a48d9cd78ffd15858ceeda66e215fb5a (patch) | |
tree | a2b7a9f62feac0c78c0fc3f4d2e4d213ea4ee4b4 | |
parent | 600f75bb29d99689e97396445d8fe7607c8d33e5 (diff) | |
download | openbsd-bfd05667a48d9cd78ffd15858ceeda66e215fb5a.tar.gz openbsd-bfd05667a48d9cd78ffd15858ceeda66e215fb5a.tar.bz2 openbsd-bfd05667a48d9cd78ffd15858ceeda66e215fb5a.zip |
Seperate real and user timer interfaces
Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.
Discussed with Scott Cheloha
Diffstat (limited to '')
-rw-r--r-- | src/usr.bin/openssl/apps.h | 5 | ||||
-rw-r--r-- | src/usr.bin/openssl/apps_posix.c | 14 | ||||
-rw-r--r-- | src/usr.bin/openssl/s_time.c | 6 | ||||
-rw-r--r-- | src/usr.bin/openssl/speed.c | 7 |
4 files changed, 15 insertions, 17 deletions
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index 4276e533f7..d02169b8aa 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.19 2016/08/30 14:34:59 deraadt Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.20 2017/12/05 15:02:06 jca Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -279,7 +279,8 @@ int app_isdir(const char *); | |||
279 | 279 | ||
280 | #define TM_START 0 | 280 | #define TM_START 0 |
281 | #define TM_STOP 1 | 281 | #define TM_STOP 1 |
282 | double app_tminterval (int stop, int usertime); | 282 | double app_timer_real(int stop); |
283 | double app_timer_user(int stop); | ||
283 | 284 | ||
284 | #define OPENSSL_NO_SSL_INTERN | 285 | #define OPENSSL_NO_SSL_INTERN |
285 | 286 | ||
diff --git a/src/usr.bin/openssl/apps_posix.c b/src/usr.bin/openssl/apps_posix.c index 94c6d35f71..502919c0a2 100644 --- a/src/usr.bin/openssl/apps_posix.c +++ b/src/usr.bin/openssl/apps_posix.c | |||
@@ -123,8 +123,8 @@ | |||
123 | 123 | ||
124 | #include "apps.h" | 124 | #include "apps.h" |
125 | 125 | ||
126 | static double | 126 | double |
127 | real_interval(int stop) | 127 | app_timer_real(int stop) |
128 | { | 128 | { |
129 | static struct timespec start; | 129 | static struct timespec start; |
130 | struct timespec elapsed, now; | 130 | struct timespec elapsed, now; |
@@ -138,8 +138,8 @@ real_interval(int stop) | |||
138 | return 0.0; | 138 | return 0.0; |
139 | } | 139 | } |
140 | 140 | ||
141 | static double | 141 | double |
142 | user_interval(int stop) | 142 | app_timer_user(int stop) |
143 | { | 143 | { |
144 | static struct timeval start; | 144 | static struct timeval start; |
145 | struct timeval elapsed; | 145 | struct timeval elapsed; |
@@ -154,12 +154,6 @@ user_interval(int stop) | |||
154 | return 0.0; | 154 | return 0.0; |
155 | } | 155 | } |
156 | 156 | ||
157 | double | ||
158 | app_tminterval(int stop, int usertime) | ||
159 | { | ||
160 | return (usertime) ? user_interval(stop) : real_interval(stop); | ||
161 | } | ||
162 | |||
163 | int | 157 | int |
164 | setup_ui(void) | 158 | setup_ui(void) |
165 | { | 159 | { |
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index e7a1ef7b63..75009f8617 100644 --- a/src/usr.bin/openssl/s_time.c +++ b/src/usr.bin/openssl/s_time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_time.c,v 1.18 2017/11/02 00:31:49 mestre Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.19 2017/12/05 15:02:06 jca Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -233,9 +233,9 @@ s_time_usage(void) | |||
233 | #define STOP 1 | 233 | #define STOP 1 |
234 | 234 | ||
235 | static double | 235 | static double |
236 | tm_Time_F(int s) | 236 | tm_Time_F(int op) |
237 | { | 237 | { |
238 | return app_tminterval(s, 1); | 238 | return app_timer_user(op); |
239 | } | 239 | } |
240 | 240 | ||
241 | /*********************************************************************** | 241 | /*********************************************************************** |
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c index 90cf6de011..4238b15f61 100644 --- a/src/usr.bin/openssl/speed.c +++ b/src/usr.bin/openssl/speed.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: speed.c,v 1.20 2017/10/07 06:16:54 guenther Exp $ */ | 1 | /* $OpenBSD: speed.c,v 1.21 2017/12/05 15:02:06 jca Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -202,7 +202,10 @@ sig_done(int sig) | |||
202 | static double | 202 | static double |
203 | Time_F(int s) | 203 | Time_F(int s) |
204 | { | 204 | { |
205 | return app_tminterval(s, usertime); | 205 | if (usertime) |
206 | return app_timer_user(s); | ||
207 | else | ||
208 | return app_timer_real(s); | ||
206 | } | 209 | } |
207 | 210 | ||
208 | 211 | ||