@@ -254,6 +254,18 @@ static void timer_exec(void)
assert_msg(irq_received, "failed to receive PPI in time, but received %d successfully\n", received);
}
+static void timer_post(uint64_t total_ticks, uint64_t ntimes, struct ns_time *total_ns)
+{
+ /*
+ * We use a 10msec timer to test the latency of PPI,
+ * so we substract the ticks of 10msec to get the
+ * actual latency
+ */
+
+ total_ticks -= ntimes * (cntfrq / 100);
+ ticks_to_ns_time(total_ticks, total_ns);
+}
+
static void hvc_exec(void)
{
asm volatile("mov w0, #0x4b000000; hvc #0" ::: "w0");
@@ -302,7 +314,7 @@ static struct exit_test tests[] = {
{"ipi", ipi_prep, ipi_exec, NULL, 65536, true},
{"ipi_hw", ipi_hw_prep, ipi_exec, NULL, 65536, true},
{"lpi", lpi_prep, lpi_exec, NULL, 65536, true},
- {"timer_10ms", timer_prep, timer_exec, NULL, 256, true},
+ {"timer_10ms", timer_prep, timer_exec, timer_post, 256, true},
};
#define PS_PER_SEC (1000 * 1000 * 1000 * 1000UL)
For we get the time duration of (10msec timer + injection latency) in timer_exec(), we substract the value of 10msec in timer_post() to get the actual latency. Signed-off-by: Jingyi Wang <wangjingyi11@huawei.com> --- arm/micro-bench.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)