Reducing the impact of the cntvct_el0 register and isb() operation on microbenchmark test results to improve testing accuracy and reduce latency in test results. --- arm/micro-bench.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arm/micro-bench.c b/arm/micro-bench.c index fbe59d03..6b940d56 100644 --- a/arm/micro-bench.c +++ b/arm/micro-bench.c @@ -346,17 +346,21 @@ static void loop_test(struct exit_test *test) } } + dsb(ish); + isb(); + start = read_sysreg(cntpct_el0); + isb(); while (ntimes < test->times && total_ns.ns < NS_5_SECONDS) { - isb(); - start = read_sysreg(cntvct_el0); test->exec(); - isb(); - end = read_sysreg(cntvct_el0); ntimes++; - total_ticks += (end - start); - ticks_to_ns_time(total_ticks, &total_ns); } + dsb(ish); + isb(); + end = read_sysreg(cntpct_el0); + + total_ticks = end - start; + ticks_to_ns_time(total_ticks, &total_ns); if (test->post) { test->post(ntimes, &total_ticks); -- 2.31.1