mempool:Add monitor dump for memory pool

Message ID 20230101051803.1363757-1-wushaohua@chinatelecom.cn (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series mempool:Add monitor dump for memory pool |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

wushaohua Jan. 1, 2023, 5:18 a.m. UTC
  From: Shaohua Wu <wushaohua@chinatelecom.cn>

rte_mempool_dump add dump for monitoring available and
used memory blocks

Signed-off-by: Shaohua Wu <wushaohua@chinatelecom.cn>
---
 lib/mempool/rte_mempool.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Morten Brørup Jan. 1, 2023, 11:28 a.m. UTC | #1
> From: wushaohua@chinatelecom.cn [mailto:wushaohua@chinatelecom.cn]
> Sent: Sunday, 1 January 2023 06.18
> 
> From: Shaohua Wu <wushaohua@chinatelecom.cn>
> 
> rte_mempool_dump add dump for monitoring available and
> used memory blocks
> 
> Signed-off-by: Shaohua Wu <wushaohua@chinatelecom.cn>
> ---
>  lib/mempool/rte_mempool.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index f33f455790..09d512a604 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool
> *mp)
> 
>  	cache_count = rte_mempool_dump_cache(f, mp);
>  	common_count = rte_mempool_ops_get_count(mp);
> +
>  	if ((cache_count + common_count) > mp->size)
>  		common_count = mp->size - cache_count;
>  	fprintf(f, "  common_pool_count=%u\n", common_count);
> +	fprintf(f, "  common_pool_avail_count=%u\n",
> +				rte_mempool_avail_count(mp));

The number of available objects in the common pool is already shown as "common_pool_count".

If you want to show the total number of available objects in both the common pool and the caches, you can calculate is as common_count + cache_count, instead of calling rte_mempool_avail_count(). And "total_count" would be a better name than "common_pool_avail_count".

> +	fprintf(f, "  common_pool_used_count=%u\n",
> +				rte_mempool_in_use_count(mp));

common_pool_used_count can be calculated as mp->size - common_count, instead of calling rte_mempool_in_use_count(mp).

> 
>  	/* sum and dump statistics */
>  #ifdef RTE_LIBRTE_MEMPOOL_STATS
> --
> 2.30.2
>
  
Thomas Monjalon Feb. 20, 2023, 1:43 p.m. UTC | #2
01/01/2023 12:28, Morten Brørup:
> > From: wushaohua@chinatelecom.cn [mailto:wushaohua@chinatelecom.cn]
> > Sent: Sunday, 1 January 2023 06.18
> > 
> > From: Shaohua Wu <wushaohua@chinatelecom.cn>
> > 
> > rte_mempool_dump add dump for monitoring available and
> > used memory blocks
> > 
> > Signed-off-by: Shaohua Wu <wushaohua@chinatelecom.cn>
> > ---
> >  lib/mempool/rte_mempool.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> > index f33f455790..09d512a604 100644
> > --- a/lib/mempool/rte_mempool.c
> > +++ b/lib/mempool/rte_mempool.c
> > @@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool
> > *mp)
> > 
> >  	cache_count = rte_mempool_dump_cache(f, mp);
> >  	common_count = rte_mempool_ops_get_count(mp);
> > +
> >  	if ((cache_count + common_count) > mp->size)
> >  		common_count = mp->size - cache_count;
> >  	fprintf(f, "  common_pool_count=%u\n", common_count);
> > +	fprintf(f, "  common_pool_avail_count=%u\n",
> > +				rte_mempool_avail_count(mp));
> 
> The number of available objects in the common pool is already shown as "common_pool_count".
> 
> If you want to show the total number of available objects in both the common pool and the caches, you can calculate is as common_count + cache_count, instead of calling rte_mempool_avail_count(). And "total_count" would be a better name than "common_pool_avail_count".
> 
> > +	fprintf(f, "  common_pool_used_count=%u\n",
> > +				rte_mempool_in_use_count(mp));
> 
> common_pool_used_count can be calculated as mp->size - common_count, instead of calling rte_mempool_in_use_count(mp).


No reply...
I assume it is a rejected patch.
  

Patch

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f455790..09d512a604 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1265,9 +1265,14 @@  rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
 	cache_count = rte_mempool_dump_cache(f, mp);
 	common_count = rte_mempool_ops_get_count(mp);
+
 	if ((cache_count + common_count) > mp->size)
 		common_count = mp->size - cache_count;
 	fprintf(f, "  common_pool_count=%u\n", common_count);
+	fprintf(f, "  common_pool_avail_count=%u\n",
+				rte_mempool_avail_count(mp));
+	fprintf(f, "  common_pool_used_count=%u\n",
+				rte_mempool_in_use_count(mp));
 
 	/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_STATS