mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
still not robust enough (Criterion cr_assert_ calls show high latency :-S)
This commit is contained in:
parent
1cede55db5
commit
2ca9193c85
1 changed files with 8 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
*********************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <criterion/criterion.h>
|
||||
|
||||
#include "timing.h"
|
||||
|
@ -88,7 +89,8 @@ Test(timing, timerfd_create_rate, .timeout = 20)
|
|||
|
||||
timerfd_wait(tfd);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
start = time_now();
|
||||
|
||||
timerfd_wait(tfd);
|
||||
|
@ -96,9 +98,13 @@ Test(timing, timerfd_create_rate, .timeout = 20)
|
|||
end = time_now();
|
||||
waited = time_delta(&start, &end);
|
||||
|
||||
cr_assert_float_eq(waited, 1.0 / rate, 10e-3, "We slept for %f instead of %f secs in round %d", waited, 1.0 / rate, i);
|
||||
if (fabs(waited - 1.0 / rate) > 10e-3)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < 10)
|
||||
cr_assert_float_eq(waited, 1.0 / rate, 10e-3, "We slept for %f instead of %f secs in round %d", waited, 1.0 / rate, i);
|
||||
|
||||
close(tfd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue