#define __MEMPOOL_STAT_ADD(mp, name, n) do { \
unsigned __lcore_id = rte_lcore_id(); \
if (__lcore_id < RTE_MAX_LCORE) { \
- mp->stats[__lcore_id].name##_objs += n; \
- mp->stats[__lcore_id].name##_bulk += 1; \
+ mp->stats[__lcore_id].name += n; \
} \
} while(0)
-#define __MEMPOOL_CONTIG_BLOCKS_STAT_ADD(mp, name, n) do { \
- unsigned int __lcore_id = rte_lcore_id(); \
- if (__lcore_id < RTE_MAX_LCORE) { \
- mp->stats[__lcore_id].name##_blks += n; \
- mp->stats[__lcore_id].name##_bulk += 1; \
- } \
- } while (0)
#else
#define __MEMPOOL_STAT_ADD(mp, name, n) do {} while(0)
-#define __MEMPOOL_CONTIG_BLOCKS_STAT_ADD(mp, name, n) do {} while (0)
#endif
/**
void **cache_objs;
/* increment stat now, adding in mempool always success */
- __MEMPOOL_STAT_ADD(mp, put, n);
+ __MEMPOOL_STAT_ADD(mp, put_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, put_objs, n);
/* No cache provided or if put would overflow mem allocated for cache */
if (unlikely(cache == NULL || n > RTE_MEMPOOL_CACHE_MAX_SIZE))
cache->len -= n;
- __MEMPOOL_STAT_ADD(mp, get_success, n);
+ __MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, get_success_objs, n);
return 0;
/* get remaining objects from ring */
ret = rte_mempool_ops_dequeue_bulk(mp, obj_table, n);
- if (ret < 0)
- __MEMPOOL_STAT_ADD(mp, get_fail, n);
- else
- __MEMPOOL_STAT_ADD(mp, get_success, n);
+ if (ret < 0) {
+ __MEMPOOL_STAT_ADD(mp, get_fail_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, get_fail_objs, n);
+ } else {
+ __MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, get_success_objs, n);
+ }
return ret;
}
ret = rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n);
if (ret == 0) {
- __MEMPOOL_CONTIG_BLOCKS_STAT_ADD(mp, get_success, n);
+ __MEMPOOL_STAT_ADD(mp, get_success_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, get_success_blks, n);
__mempool_contig_blocks_check_cookies(mp, first_obj_table, n,
1);
} else {
- __MEMPOOL_CONTIG_BLOCKS_STAT_ADD(mp, get_fail, n);
+ __MEMPOOL_STAT_ADD(mp, get_fail_bulk, 1);
+ __MEMPOOL_STAT_ADD(mp, get_fail_blks, n);
}
rte_mempool_trace_get_contig_blocks(mp, first_obj_table, n);