diff options
author | Matias Elo <matias.elo@nokia.com> | 2021-11-05 14:58:24 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2021-11-11 16:15:50 +0200 |
commit | 3def5dd8acbbb93b6edb6ceef954d72ffe945884 (patch) | |
tree | b985ad048bd55f82a2a9929218be2cf03e18efdd | |
parent | 737d3fed2ad90c60ca96e091919fd3e0ff9c5356 (diff) |
linux-gen: pool: implement new odp_pool_print_all() function
Add implementation for the new odp_pool_print_all() function.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r-- | platform/linux-generic/odp_pool.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index f91c1b9f1..49d2e74f5 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -1420,6 +1420,56 @@ void odp_pool_print(odp_pool_t pool_hdl) ODP_PRINT("\n"); } +void odp_pool_print_all(void) +{ + uint64_t available; + uint32_t i, index, tot, cache_size, seg_len; + uint32_t buf_len = 0; + uint8_t type, ext; + const int col_width = 24; + const char *name; + char type_c; + + ODP_PRINT("\nList of all pools\n"); + ODP_PRINT("-----------------\n"); + ODP_PRINT(" idx %-*s type free tot cache buf_len ext\n", col_width, "name"); + + for (i = 0; i < ODP_CONFIG_POOLS; i++) { + pool_t *pool = pool_entry(i); + + LOCK(&pool->lock); + + if (!pool->reserved) { + UNLOCK(&pool->lock); + continue; + } + + available = ring_ptr_len(&pool->ring->hdr); + cache_size = pool->cache_size; + ext = pool->pool_ext; + index = pool->pool_idx; + name = pool->name; + tot = pool->num; + type = pool->type; + seg_len = pool->seg_len; + + UNLOCK(&pool->lock); + + if (type == ODP_POOL_BUFFER || type == ODP_POOL_PACKET) + buf_len = seg_len; + + type_c = (type == ODP_POOL_BUFFER) ? 'B' : + (type == ODP_POOL_PACKET) ? 'P' : + (type == ODP_POOL_TIMEOUT) ? 'T' : + (type == ODP_POOL_VECTOR) ? 'V' : '-'; + + ODP_PRINT("%4u %-*s %c %6" PRIu64 " %6" PRIu32 " %6" PRIu32 " %8" PRIu32 " " + "%" PRIu8 "\n", index, col_width, name, type_c, available, tot, + cache_size, buf_len, ext); + } + ODP_PRINT("\n"); +} + odp_pool_t odp_buffer_pool(odp_buffer_t buf) { pool_t *pool = pool_from_buf(buf); |