[dpdk-dev] [PATCH v7 11/17] test/ring: modify burst enq/deq perf test cases

Honnappa Nagarahalli Honnappa.Nagarahalli at arm.com
Tue Jan 7 06:42:16 CET 2020


<snip>

> >
> > Add test cases to test legacy and rte_ring_xxx_elem APIs for burst
> > enqueue/dequeue test cases.
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> > Reviewed-by: Gavin Hu <gavin.hu at arm.com>
> > ---
> >  app/test/test_ring_perf.c | 78
> > ++++++++++++++++++++-------------------
> >  1 file changed, 40 insertions(+), 38 deletions(-)
> >
> > diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
> > index 5829718c1..508c688dc 100644
> > --- a/app/test/test_ring_perf.c
> > +++ b/app/test/test_ring_perf.c
> > @@ -397,47 +397,40 @@ test_single_enqueue_dequeue(struct rte_ring *r,
> > const int esize,  }
> >
> >  /*
> > - * Test that does both enqueue and dequeue on a core using the
> > burst() API calls
> > - * instead of the bulk() calls used in other tests. Results should be
> > the same
> > - * as for the bulk function called on a single lcore.
> > + * Test that does both enqueue and dequeue on a core using the
> > + burst/bulk API
> > + * calls Results should be the same as for the bulk function called
> > + on a
> > + * single lcore.
> >   */
> > -static void
> > -test_burst_enqueue_dequeue(struct rte_ring *r)
> > +static int
> > +test_burst_bulk_enqueue_dequeue(struct rte_ring *r, const int esize,
> > +	const unsigned int api_type)
> >  {
> > -	const unsigned iter_shift = 23;
> > -	const unsigned iterations = 1<<iter_shift;
> > -	unsigned sz, i = 0;
> > -	void *burst[MAX_BURST] = {0};
> > +	int ret;
> > +	const unsigned int iter_shift = 23;
> > +	const unsigned int iterations = 1 << iter_shift;
> > +	unsigned int sz, i = 0;
> > +	void **burst = NULL;
> >
> > -	for (sz = 0; sz < sizeof(bulk_sizes)/sizeof(bulk_sizes[0]); sz++) {
> > -		const uint64_t sc_start = rte_rdtsc();
> > -		for (i = 0; i < iterations; i++) {
> > -			rte_ring_sp_enqueue_burst(r, burst,
> > -					bulk_sizes[sz], NULL);
> > -			rte_ring_sc_dequeue_burst(r, burst,
> > -					bulk_sizes[sz], NULL);
> > -		}
> > -		const uint64_t sc_end = rte_rdtsc();
> > +	(void)ret;
> > +	burst = test_ring_calloc(MAX_BURST, esize);
> > +	if (burst == NULL)
> > +		return -1;
> >
> > -		const uint64_t mc_start = rte_rdtsc();
> > +	for (sz = 0; sz < RTE_DIM(bulk_sizes); sz++) {
> > +		const uint64_t start = rte_rdtsc();
> >  		for (i = 0; i < iterations; i++) {
> > -			rte_ring_mp_enqueue_burst(r, burst,
> > -					bulk_sizes[sz], NULL);
> > -			rte_ring_mc_dequeue_burst(r, burst,
> > -					bulk_sizes[sz], NULL);
> > +			TEST_RING_ENQUEUE(r, burst, esize, bulk_sizes[sz],
> > +						ret, api_type);
> > +			TEST_RING_DEQUEUE(r, burst, esize, bulk_sizes[sz],
> > +						ret, api_type);
> >  		}
> > -		const uint64_t mc_end = rte_rdtsc();
> > -
> > -		double mc_avg = ((double)(mc_end-mc_start) / iterations) /
> > -					bulk_sizes[sz];
> > -		double sc_avg = ((double)(sc_end-sc_start) / iterations) /
> > -					bulk_sizes[sz];
> > +		const uint64_t end = rte_rdtsc();
> >
> > -		printf("SP/SC burst enq/dequeue (size: %u): %.2F\n",
> > -				bulk_sizes[sz], sc_avg);
> > -		printf("MP/MC burst enq/dequeue (size: %u): %.2F\n",
> > -				bulk_sizes[sz], mc_avg);
> > +		test_ring_print_test_string(api_type, esize, bulk_sizes[sz],
> > +					((double)(end - start)) / iterations);
> >  	}
> > +
> 
> missing rte_free(burst);
> ?
Yes, will fix.

> 
> > +	return 0;
> >  }
> >


More information about the dev mailing list