From: Laurent MAZET Date: Thu, 23 Oct 2025 17:51:24 +0000 (+0200) Subject: correct cycle test X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=42ec728cf5181f0c3b1229a2bd1ff4f8308d50ce;p=benchmarks.git correct cycle test --- diff --git a/cycle.c b/cycle.c index 69852a7..1b0204b 100644 --- a/cycle.c +++ b/cycle.c @@ -41,13 +41,13 @@ void *ping (__attribute__((unused)) void *arg) for (int i = -1; i < nb_measurements; i++) { - int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX); + int duration = MINDUR * (1 + (rand () % (MAXDUR / MINDUR))); ts_t ts1, ts2; sys_timestamp (&ts1); usleep (duration); sys_timestamp (&ts2); - if (i != -1) deltas[i] = diff_timestamp (&ts2, &ts1) - duration; + if (i != -1) deltas[i] = diff_timestamp (&ts2, &ts1) - duration * 1000; } pthread_exit (NULL);