From cd2216880c35d3ed7942221b08ac837561d783d6 Mon Sep 17 00:00:00 2001 From: Petri Savolainen Date: Wed, 15 Nov 2023 15:28:56 +0200 Subject: [PATCH] linux-gen: pool: remove per thread stats zeroing Simplify and speed up pool statistics function a bit by removing unnecessary zeroing of per thread statistics. Signed-off-by: Petri Savolainen Reviewed-by: Matias Elo Acked-by: Ashwin Sekhar T K --- platform/linux-generic/odp_pool.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 59908644dc..94461e6b11 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -1688,7 +1688,6 @@ unsigned int odp_pool_max_index(void) int odp_pool_stats(odp_pool_t pool_hdl, odp_pool_stats_t *stats) { pool_t *pool; - uint16_t first, last; if (odp_unlikely(pool_hdl == ODP_POOL_INVALID)) { _ODP_ERR("Invalid pool handle\n"); @@ -1700,14 +1699,9 @@ int odp_pool_stats(odp_pool_t pool_hdl, odp_pool_stats_t *stats) } pool = _odp_pool_entry(pool_hdl); - first = stats->thread.first; - last = stats->thread.last; - memset(stats, 0, sizeof(odp_pool_stats_t)); - - /* Restore input parameters */ - stats->thread.first = first; - stats->thread.last = last; + /* Zero everything else but per thread statistics */ + memset(stats, 0, offsetof(odp_pool_stats_t, thread)); if (pool->params.stats.bit.available) stats->available = ring_ptr_len(&pool->ring->hdr);