[sr-dev] git:master:bee6a696: core: mem/shm - api to get per module use/free stats

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 2 14:00:19 CET 2015


Module: kamailio
Branch: master
Commit: bee6a696148adcd6ceb2f7a2ca7758156ed3ffba
URL: https://github.com/kamailio/kamailio/commit/bee6a696148adcd6ceb2f7a2ca7758156ed3ffba

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-02T13:44:05+01:00

core: mem/shm - api to get per module use/free stats

---

Modified: mem/shm.c
Modified: mem/shm.h

---

Diff:  https://github.com/kamailio/kamailio/commit/bee6a696148adcd6ceb2f7a2ca7758156ed3ffba.diff
Patch: https://github.com/kamailio/kamailio/commit/bee6a696148adcd6ceb2f7a2ca7758156ed3ffba.patch

---

diff --git a/mem/shm.c b/mem/shm.c
index df8e13e..94a9915 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 47d11df..cbf4c3a 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);




More information about the sr-dev mailing list