Module: sip-router Branch: master Commit: a31cd01bbd64f1e5d98b0032f7ce6f9158fec720 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a31cd01b...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Wed Jul 21 21:21:38 2010 +0200
core: more control on mem usage printing
- mem_summary value controls separately printing pkg and shm status - 0 - disabled - 1 - pkg status - 2 - shm status - 4 - pkg summary - 8 - shm summary - default is 3 - pkg/shm status - the value can be updated via rpc, making easier to troubleshoot separately shm or pkg
---
cfg_core.c | 5 +++-- main.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/cfg_core.c b/cfg_core.c index d819dee..79b1cae 100644 --- a/cfg_core.c +++ b/cfg_core.c @@ -115,7 +115,8 @@ struct cfg_group_core default_core_cfg = { 0, /*!< udp_mtu_try_proto -> default disabled */ 0, /*!< force_rport */ L_DBG, /*!< memlog */ - 1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */ + 3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status, + 4 pkg_sums, 8 shm_sums */ };
void *core_cfg = &default_core_cfg; @@ -233,7 +234,7 @@ cfg_def_t core_cfg_def[] = { "force rport for all the received messages" }, {"memlog", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0, "log level for memory status/summary information"}, - {"mem_summary", CFG_VAR_INT|CFG_ATOMIC, 0, 3, 0, 0, + {"mem_summary", CFG_VAR_INT|CFG_ATOMIC, 0, 15, 0, 0, "memory debugging information displayed on exit (flags): " " 0 - off, 1 - dump all the used blocks (status)," " 2 - summary of used blocks" }, diff --git a/main.c b/main.c index 54638b4..e79d810 100644 --- a/main.c +++ b/main.c @@ -554,7 +554,7 @@ void cleanup(show_status) LOG(memlog, "Memory status (pkg):\n"); pkg_status(); } - if (cfg_get(core, core_cfg, mem_summary) & 2) { + if (cfg_get(core, core_cfg, mem_summary) & 4) { LOG(memlog, "Memory still-in-use summary (pkg):\n"); pkg_sums(); } @@ -564,11 +564,11 @@ void cleanup(show_status) if (pt) shm_free(pt); pt=0; if (show_status && memlog <= cfg_get(core, core_cfg, debug)){ - if (cfg_get(core, core_cfg, mem_summary) & 1) { + if (cfg_get(core, core_cfg, mem_summary) & 2) { LOG(memlog, "Memory status (shm):\n"); shm_status(); } - if (cfg_get(core, core_cfg, mem_summary) & 2) { + if (cfg_get(core, core_cfg, mem_summary) & 8) { LOG(memlog, "Memory still-in-use summary (shm):\n"); shm_sums(); }