From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org
Cc: Robin Jarry <rjarry@redhat.com>
Subject: [PATCH] mempool: add object usage counts for the telemetry api
Date: Tue, 15 Nov 2022 16:35:55 +0100 [thread overview]
Message-ID: <20221115153555.947526-1-rjarry@redhat.com> (raw)
rte_mempool_dump() already returns the number of objects available and
in the cache. This information is missing from the telemetry API. Add it
albeit with less granularity for cached counts (only report the
total_cache_count).
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
lib/mempool/rte_mempool.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f45579091..ae56f6d38b35 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1495,6 +1495,7 @@ mempool_info_cb(struct rte_mempool *mp, void *arg)
{
struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg;
const struct rte_memzone *mz;
+ uint64_t cache_count, common_count;
if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE))
return;
@@ -1513,6 +1514,18 @@ mempool_info_cb(struct rte_mempool *mp, void *arg)
rte_tel_data_add_dict_int(info->d, "ops_index", mp->ops_index);
rte_tel_data_add_dict_int(info->d, "populated_size",
mp->populated_size);
+ cache_count = 0;
+ if (mp->cache_size > 0) {
+ int lcore_id;
+ for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
+ cache_count += mp->local_cache[lcore_id].len;
+ }
+ common_count = rte_mempool_ops_get_count(mp);
+ if ((cache_count + common_count) > mp->size)
+ common_count = mp->size - cache_count;
+
+ rte_tel_data_add_dict_u64(info->d, "total_cache_count", cache_count);
+ rte_tel_data_add_dict_u64(info->d, "common_pool_count", common_count);
mz = mp->mz;
rte_tel_data_add_dict_string(info->d, "mz_name", mz->name);
--
2.38.1
next reply other threads:[~2022-11-15 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 15:35 Robin Jarry [this message]
2022-11-15 16:28 ` Morten Brørup
2023-02-05 23:30 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221115153555.947526-1-rjarry@redhat.com \
--to=rjarry@redhat.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).