diff options
| -rw-r--r-- | src/usr.bin/openssl/s_time.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index 8aa3d9fbea..906d36228f 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.28 2018/08/21 15:56:39 cheloha Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.29 2018/08/22 20:36:24 cheloha 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 | * |
| @@ -227,18 +227,6 @@ s_time_usage(void) | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /*********************************************************************** | 229 | /*********************************************************************** |
| 230 | * TIME - time functions | ||
| 231 | */ | ||
| 232 | #define START TM_RESET | ||
| 233 | #define STOP TM_GET | ||
| 234 | |||
| 235 | static double | ||
| 236 | tm_Time_F(int op) | ||
| 237 | { | ||
| 238 | return app_timer_user(op); | ||
| 239 | } | ||
| 240 | |||
| 241 | /*********************************************************************** | ||
| 242 | * MAIN - main processing area for client | 230 | * MAIN - main processing area for client |
| 243 | * real name depends on MONOLITH | 231 | * real name depends on MONOLITH |
| 244 | */ | 232 | */ |
| @@ -407,10 +395,9 @@ run_test(SSL *scon) | |||
| 407 | static int | 395 | static int |
| 408 | benchmark(int reuse_session) | 396 | benchmark(int reuse_session) |
| 409 | { | 397 | { |
| 410 | double totalTime = 0.0; | 398 | double elapsed, totalTime; |
| 411 | int nConn = 0; | 399 | int nConn = 0; |
| 412 | SSL *scon = NULL; | 400 | SSL *scon = NULL; |
| 413 | time_t finishtime; | ||
| 414 | int ret = 1; | 401 | int ret = 1; |
| 415 | int ver; | 402 | int ver; |
| 416 | 403 | ||
| @@ -426,15 +413,13 @@ benchmark(int reuse_session) | |||
| 426 | } | 413 | } |
| 427 | 414 | ||
| 428 | nConn = 0; | 415 | nConn = 0; |
| 429 | totalTime = 0.0; | ||
| 430 | |||
| 431 | finishtime = time(NULL) + s_time_config.maxtime; | ||
| 432 | |||
| 433 | bytes_read = 0; | 416 | bytes_read = 0; |
| 434 | tm_Time_F(START); | ||
| 435 | 417 | ||
| 418 | app_timer_real(TM_RESET); | ||
| 419 | app_timer_user(TM_RESET); | ||
| 436 | for (;;) { | 420 | for (;;) { |
| 437 | if (finishtime < time(NULL)) | 421 | elapsed = app_timer_real(TM_GET); |
| 422 | if (elapsed > s_time_config.maxtime) | ||
| 438 | break; | 423 | break; |
| 439 | if (scon == NULL) { | 424 | if (scon == NULL) { |
| 440 | if ((scon = SSL_new(tm_ctx)) == NULL) | 425 | if ((scon = SSL_new(tm_ctx)) == NULL) |
| @@ -464,13 +449,13 @@ benchmark(int reuse_session) | |||
| 464 | scon = NULL; | 449 | scon = NULL; |
| 465 | } | 450 | } |
| 466 | } | 451 | } |
| 467 | totalTime += tm_Time_F(STOP); /* Add the time for this iteration */ | 452 | totalTime = app_timer_user(TM_GET); |
| 468 | 453 | ||
| 469 | printf("\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", | 454 | printf("\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", |
| 470 | nConn, totalTime, ((double) nConn / totalTime), bytes_read); | 455 | nConn, totalTime, ((double) nConn / totalTime), bytes_read); |
| 471 | printf("%d connections in %lld real seconds, %ld bytes read per connection\n", | 456 | printf("%d connections in %.0f real seconds, %ld bytes read per connection\n", |
| 472 | nConn, | 457 | nConn, |
| 473 | (long long)(time(NULL) - finishtime + s_time_config.maxtime), | 458 | elapsed, |
| 474 | bytes_read / nConn); | 459 | bytes_read / nConn); |
| 475 | 460 | ||
| 476 | ret = 0; | 461 | ret = 0; |
