From: Alan T. DeKok Date: Fri, 23 Sep 2022 14:15:05 +0000 (-0400) Subject: fix compiler errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fdd016fc4a7e56e774f263418f65a8c36ec4ea9;p=thirdparty%2Ffreeradius-server.git fix compiler errors --- diff --git a/src/lib/util/time_tests.c b/src/lib/util/time_tests.c index 158535e0a45..8e667d8c2c3 100644 --- a/src/lib/util/time_tests.c +++ b/src/lib/util/time_tests.c @@ -24,6 +24,9 @@ #include #include +#define ROUNDS (100000) + +DIAG_OFF(unused-but-set-variable) static void time_benchmark(void) { int i; @@ -31,20 +34,20 @@ static void time_benchmark(void) uint64_t rate; start = fr_time(); - for (i = 0; i < 100000; i++) { - fr_time_t now; + for (i = 0; i < ROUNDS; i++) { + volatile fr_time_t now; - (fr_time_t volatile)now = fr_time(); + now = fr_time(); } stop = fr_time(); - rate = (uint64_t)((float)NSEC / (fr_time_delta_unwrap(fr_time_sub(stop, start)) / 100000)); + rate = (uint64_t)((float)NSEC / (fr_time_delta_unwrap(fr_time_sub(stop, start)) / ROUNDS)); printf("fr_time rate %" PRIu64 "\n", rate); /* shared runners are terrible for performance tests */ - if (!getenv("NO_PERFORMANCE_TESTS")) TEST_CHECK(rate > 1000000); + if (!getenv("NO_PERFORMANCE_TESTS")) TEST_CHECK(rate > (ROUNDS * 10)); } - +DIAG_ON(unused-but-set-variable) TEST_LIST = { { "time_const_benchmark", time_benchmark },