From bee6a696148adcd6ceb2f7a2ca7758156ed3ffba Mon Sep 17 00:00:00 2001 From: Stefan Mititelu Date: Mon, 2 Nov 2015 13:44:05 +0100 Subject: [PATCH] core: mem/shm - api to get per module use/free stats --- mem/shm.c | 2 ++ mem/shm.h | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mem/shm.c b/mem/shm.c index df8e13e4877..94a99150e91 100644 --- a/mem/shm.c +++ b/mem/shm.c @@ -221,6 +221,8 @@ int shm_init_api(sr_shm_api_t *ap) _shm_root.xavailable = ap->xavailable; _shm_root.xsums = ap->xsums; _shm_root.xdestroy = ap->xdestroy; + _shm_root.xstats = ap->xstats; + _shm_root.xfstats = ap->xfstats; return 0; } diff --git a/mem/shm.h b/mem/shm.h index 47d11df2e23..cbf4c3a77be 100644 --- a/mem/shm.h +++ b/mem/shm.h @@ -49,17 +49,17 @@ extern sr_shm_api_t _shm_root; #ifdef DBG_SR_MEMORY # define shm_malloc(s) _shm_root.xmalloc(_shm_root.mem_block, (s), _SRC_LOC_, \ - _SRC_FUNCTION_, _SRC_LINE_) + _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) # define shm_malloc_unsafe(s) _shm_root.xmalloc_unsafe(_shm_root.mem_block, (s), _SRC_LOC_, \ - _SRC_FUNCTION_, _SRC_LINE_) + _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) # define shm_realloc(p, s) _shm_root.xrealloc(_shm_root.mem_block, (p), (s), \ - _SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_) + _SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) # define shm_resize(p, s) _shm_root.xresize(_shm_root.mem_block, (p), (s), \ - _SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_) + _SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) # define shm_free(p) _shm_root.xfree(_shm_root.mem_block, (p), _SRC_LOC_, \ - _SRC_FUNCTION_, _SRC_LINE_) + _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) # define shm_free_unsafe(p) _shm_root.xfree_unsafe(_shm_root.mem_block, (p), _SRC_LOC_, \ - _SRC_FUNCTION_, _SRC_LINE_) + _SRC_FUNCTION_, _SRC_LINE_, _SRC_MODULE_) #else # define shm_malloc(s) _shm_root.xmalloc(_shm_root.mem_block, (s)) # define shm_malloc_unsafe(s) _shm_root.xmalloc_unsafe(_shm_root.mem_block, (s)) @@ -73,6 +73,9 @@ extern sr_shm_api_t _shm_root; # define shm_info(mi) _shm_root.xinfo(_shm_root.mem_block, mi) # define shm_available() _shm_root.xavailable(_shm_root.mem_block) # define shm_sums() _shm_root.xsums(_shm_root.mem_block) +# define shm_mod_get_stats(x) _shm_root.xstats(_shm_root.mem_block, x) +# define shm_mod_free_stats(x) _shm_root.xfstats(x) + void* shm_core_get_pool(void); int shm_init_api(sr_shm_api_t *ap);