W dniu 01.05.2020 o 17:56, Harry van Haaren pisze: > Add a performance test to the service run on app lcore auto- > test. This test runs the service in a tight loop, and measures > cycles passed, printing the results. It provides a quick cycle > cost value, enabling measuring performance of the function to > run a service on an application lcore. > > Signed-off-by: Harry van Haaren <harry.van.haa...@intel.com> > > --- > > I'm suggesting to merge this patch before the bugfix/C11 patch series, > (v2 currently here: > https://protect2.fireeye.com/url?k=fda15556-a06d9cd2-fda0de19-0cc47aa8f5ba-177ac65d20682aa8&q=1&u=http%3A%2F%2Fpatches.dpdk.org%2Fpatch%2F69199%2F > ) > as this would enable users to benchmark the "before" and "after" > states of the bugfix/C11 patches easier. > > --- > app/test/test_service_cores.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c > index a922c7ddc..469243314 100644 > --- a/app/test/test_service_cores.c > +++ b/app/test/test_service_cores.c > @@ -789,8 +789,18 @@ 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(); > + for (uint32_t 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; > } >
Hi Harry, I like the idea of adding this test. I checked it and it works fine. However have you considered adding it as a separate testcase or even better as "service_perf_autotest" command ? With your changes the: service_app_lcore_mt_safe and service_app_lcore_mt_unsafe unit tests cases have multiple functionalities: they test simultaneous execution of service and they do performance checks. Best regards Lukasz -- Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 l.wojciec...@partner.samsung.com