[dpdk-dev,v2] test: fix mempool perf test enq_count wraparound of 32-bit uint

Message ID 1464272154-94512-1-git-send-email-david.hunt@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Hunt, David May 26, 2016, 2:15 p.m. UTC
  recent CPU's can easily wrap around a 32-bit unsigned int in
the mempool perf test. Increase to a 64-bit uint.

v2: change from %lu to %"PRIu64"

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 app/test/test_mempool_perf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Olivier Matz May 30, 2016, 8:47 a.m. UTC | #1
Hi David,

On 05/26/2016 04:15 PM, David Hunt wrote:
> recent CPU's can easily wrap around a 32-bit unsigned int in
> the mempool perf test. Increase to a 64-bit uint.
> 
> v2: change from %lu to %"PRIu64"
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  
Thomas Monjalon June 13, 2016, 8:23 p.m. UTC | #2
> > recent CPU's can easily wrap around a 32-bit unsigned int in
> > the mempool perf test. Increase to a 64-bit uint.
> > 
> > v2: change from %lu to %"PRIu64"
> > 
> > Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks
  

Patch

diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c
index cdc02a0..0fc8110 100644
--- a/app/test/test_mempool_perf.c
+++ b/app/test/test_mempool_perf.c
@@ -110,7 +110,7 @@  static unsigned n_keep;
 
 /* number of enqueues / dequeues */
 struct mempool_test_stats {
-	unsigned enq_count;
+	uint64_t enq_count;
 } __rte_cache_aligned;
 
 static struct mempool_test_stats stats[RTE_MAX_LCORE];
@@ -189,7 +189,7 @@  static int
 launch_cores(unsigned cores)
 {
 	unsigned lcore_id;
-	unsigned rate;
+	uint64_t rate;
 	int ret;
 	unsigned cores_save = cores;
 
@@ -238,7 +238,7 @@  launch_cores(unsigned cores)
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
 		rate += (stats[lcore_id].enq_count / TIME_S);
 
-	printf("rate_persec=%u\n", rate);
+	printf("rate_persec=%"PRIu64"\n", rate);
 
 	return 0;
 }