[v2] test/service: add perf test for service on app lcore

Message ID 20200506171642.32105-1-harry.van.haaren@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] test/service: add perf test for service on app lcore |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS

Commit Message

Van Haaren, Harry May 6, 2020, 5:16 p.m. UTC
  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>

---

v2:
- Add space at start of output (Phil Yang)
- Fix compile error on older GCCs (David Marchand)

---
 app/test/test_service_cores.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Comments

Phil Yang May 7, 2020, 6:28 a.m. UTC | #1
> -----Original Message-----
> From: Harry van Haaren <harry.van.haaren@intel.com>
> Sent: Thursday, May 7, 2020 1:17 AM
> To: dev@dpdk.org
> Cc: david.marchand@redhat.com; Phil Yang <Phil.Yang@arm.com>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Harry van Haaren
> <harry.van.haaren@intel.com>
> Subject: [PATCH v2] 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>
> 
> ---
> 
> v2:
> - Add space at start of output (Phil Yang)
> - Fix compile error on older GCCs (David Marchand)
> 
> ---
>  app/test/test_service_cores.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
> index a922c7ddc..75a3f8b45 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() */
> +	uint32_t i;
> +	const uint32_t perf_iters = (1 << 12);
> +	uint64_t start = rte_rdtsc();
> +	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("\t\tperf test for %s: %0.1f cycles per call\n", mt_safe ?

This print will be printed before the function test result.
Apologize for my previous comments. Please ignore it. 

A nitpick comment on formatting the output.

-       printf("\t\tperf test for %s: %0.1f cycles per call\n", mt_safe ?
+       printf("Perf test for %-10s: %0.1f cycles per call\n", mt_safe ?


Tested-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>

Thanks,
Phil

> +		"MT Safe" : "MT Unsafe", (end - start)/(float)perf_iters);
> 
> +	unregister_all();
>  	return TEST_SUCCESS;
>  }
> 
> --
> 2.17.1
  
David Marchand May 7, 2020, 12:11 p.m. UTC | #2
On Thu, May 7, 2020 at 8:29 AM Phil Yang <Phil.Yang@arm.com> wrote:
>
> > -----Original Message-----
> > From: Harry van Haaren <harry.van.haaren@intel.com>
> > Sent: Thursday, May 7, 2020 1:17 AM
> > To: dev@dpdk.org
> > Cc: david.marchand@redhat.com; Phil Yang <Phil.Yang@arm.com>;
> > Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Harry van Haaren
> > <harry.van.haaren@intel.com>
> > Subject: [PATCH v2] 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>
> >
> > ---
> >
> > v2:
> > - Add space at start of output (Phil Yang)
> > - Fix compile error on older GCCs (David Marchand)
> >
> > ---
> >  app/test/test_service_cores.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
> > index a922c7ddc..75a3f8b45 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() */
> > +     uint32_t i;
> > +     const uint32_t perf_iters = (1 << 12);
> > +     uint64_t start = rte_rdtsc();
> > +     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("\t\tperf test for %s: %0.1f cycles per call\n", mt_safe ?
>
> This print will be printed before the function test result.
> Apologize for my previous comments. Please ignore it.
>
> A nitpick comment on formatting the output.
>
> -       printf("\t\tperf test for %s: %0.1f cycles per call\n", mt_safe ?
> +       printf("Perf test for %-10s: %0.1f cycles per call\n", mt_safe ?
>
>
> Tested-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>

Ok, so I will restore this part from the v1 when applying.
  
David Marchand May 11, 2020, 11:20 a.m. UTC | #3
On Wed, May 6, 2020 at 7:15 PM Harry van Haaren
<harry.van.haaren@intel.com> wrote:
>
> 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>

Restored output to v1 format following Phil comment.

Applied, thanks.
  

Patch

diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
index a922c7ddc..75a3f8b45 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() */
+	uint32_t i;
+	const uint32_t perf_iters = (1 << 12);
+	uint64_t start = rte_rdtsc();
+	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("\t\tperf 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;
 }