app/test: fix wraparound of mempool performance rate
authorDavid Hunt <david.hunt@intel.com>
Thu, 26 May 2016 14:15:54 +0000 (15:15 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 13 Jun 2016 20:22:15 +0000 (22:22 +0200)
Recent CPU's can easily wrap around a 32-bit unsigned int in
the mempool perf test. Increase to a 64-bit uint.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
app/test/test_mempool_perf.c

index cdc02a0..c5e3576 100644 (file)
@@ -110,7 +110,7 @@ static unsigned n_keep;
 
 /* number of enqueues / dequeues */
 struct mempool_test_stats {
 
 /* 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];
 } __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;
 launch_cores(unsigned cores)
 {
        unsigned lcore_id;
-       unsigned rate;
+       uint64_t rate;
        int ret;
        unsigned cores_save = cores;
 
        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);
 
        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;
 }
 
        return 0;
 }