On Fri, May 1, 2020 at 5:56 PM Harry van Haaren <harry.van.haa...@intel.com> wrote: > > 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: http://patches.dpdk.org/patch/69199/ ) > 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++) {
- How long does this test take now? We tend to put performance tests in dedicated tests to avoid issues in Travis. I suppose this is quick, but still want a confirmation. - Centos7/RHEL7 gcc is not happy with this. http://mails.dpdk.org/archives/test-report/2020-May/129993.html ../app/test/test_service_cores.c: In function ‘service_app_lcore_poll_impl’: ../app/test/test_service_cores.c:795:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (uint32_t i = 0; i < perf_iters; i++) { ^ ../app/test/test_service_cores.c:795:2: note: use option -std=c99 or -std=gnu99 to compile your code > + 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; > } > - Can you look at Phil comments too? -- David Marchand