Skip to content

Commit

Permalink
linux-gen: pool: remove per thread stats zeroing
Browse files Browse the repository at this point in the history
Simplify and speed up pool statistics function a bit by removing
unnecessary zeroing of per thread statistics.

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Acked-by: Ashwin Sekhar T K <asekhar@marvell.com>
  • Loading branch information
psavol authored and MatiasElo committed Dec 19, 2023
1 parent 369b558 commit cd22168
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions platform/linux-generic/odp_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand Down

0 comments on commit cd22168

Please sign in to comment.