test/service: add perf test for service on app lcore

This commit adds a basic test to check the cycle cost
of related to calling into a service.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Tested-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
This commit is contained in:
Harry van Haaren 2020-05-06 18:16:42 +01:00 committed by David Marchand
parent 24cd1b529f
commit 9ec8f11369

View File

@ -789,8 +789,19 @@ service_app_lcore_poll_impl(const int mt_safe)
"MT Unsafe: App core1 didn't return -EBUSY");
}
unregister_all();
/* Performance test: call in a loop, and measure tsc() */
const uint32_t perf_iters = (1 << 12);
uint64_t start = rte_rdtsc();
uint32_t i;
for (i = 0; i < perf_iters; i++) {
int err = service_run_on_app_core_func(&id);
TEST_ASSERT_EQUAL(0, err, "perf test: returned run failure");
}
uint64_t end = rte_rdtsc();
printf("perf test for %s: %0.1f cycles per call\n", mt_safe ?
"MT Safe" : "MT Unsafe", (end - start)/(float)perf_iters);
unregister_all();
return TEST_SUCCESS;
}