From: Harry van Haaren Date: Wed, 6 May 2020 17:16:42 +0000 (+0100) Subject: test/service: add perf test for service on app lcore X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9ec8f11369dd816da9347afc516d8ccdd35f3755;p=dpdk.git 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 Tested-by: Phil Yang Reviewed-by: Phil Yang --- diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index a922c7ddcc..981e212130 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -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; }