mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
timer test: be more tolerant in periodic test
For some platforms (at least hw_zynq on Qemu), the measured time of the periodic timeout test exceeded the maximum that was previously calculated without any tolerance. Most likely, this is not a malfunction of the test subject as the error is pretty small and, of course, measuring the time produces overhead itself. Introducing a tolerance of only 0.1% fixes the problem. Fixes #1599
This commit is contained in:
parent
be994641ef
commit
349c15dfe4
@ -147,8 +147,10 @@ int main(int argc, char **argv)
|
||||
i += s.num();
|
||||
}
|
||||
elapsed_ms = main_timer.elapsed_ms() - elapsed_ms;
|
||||
unsigned const min_ms = ((i - 1) * period_us) / 1000;
|
||||
unsigned const max_ms = (i * period_us) / 1000;
|
||||
unsigned const min_ms = ((i - 1) * period_us) / 1000;
|
||||
unsigned const max_us = i * period_us;
|
||||
unsigned const max_err_us = max_us / 100;
|
||||
unsigned const max_ms = (max_us + max_err_us) / 1000;
|
||||
if (min_ms > elapsed_ms || max_ms < elapsed_ms) {
|
||||
PERR("Timing %u ms period %u times failed: %u ms (min %u, max %u)",
|
||||
period_us / 1000, i, elapsed_ms, min_ms, max_ms);
|
||||
|
Loading…
Reference in New Issue
Block a user