Browse code

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

Daniel-Constantin Mierla authored on 21/07/2010 19:21:38
Showing 2 changed files
... ...
@@ -115,7 +115,8 @@ struct cfg_group_core default_core_cfg = {
115 115
 	0, /*!< udp_mtu_try_proto -> default disabled */
116 116
 	0,  /*!< force_rport */
117 117
 	L_DBG, /*!< memlog */
118
-	1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */
118
+	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
119
+		4 pkg_sums, 8 shm_sums */
119 120
 };
120 121
 
121 122
 void	*core_cfg = &default_core_cfg;
... ...
@@ -233,7 +234,7 @@ cfg_def_t core_cfg_def[] = {
233 233
 		"force rport for all the received messages" },
234 234
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
235 235
 		"log level for memory status/summary information"},
236
-	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 3, 0, 0,
236
+	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 15, 0, 0,
237 237
 		"memory debugging information displayed on exit (flags): "
238 238
 		" 0 - off, 1 - dump all the used blocks (status),"
239 239
 		" 2 - summary of used blocks" },
... ...
@@ -554,7 +554,7 @@ void cleanup(show_status)
554 554
 			LOG(memlog, "Memory status (pkg):\n");
555 555
 			pkg_status();
556 556
 		}
557
-		if (cfg_get(core, core_cfg, mem_summary) & 2) {
557
+		if (cfg_get(core, core_cfg, mem_summary) & 4) {
558 558
 			LOG(memlog, "Memory still-in-use summary (pkg):\n");
559 559
 			pkg_sums();
560 560
 		}
... ...
@@ -564,11 +564,11 @@ void cleanup(show_status)
564 564
 	if (pt) shm_free(pt);
565 565
 	pt=0;
566 566
 	if (show_status && memlog <= cfg_get(core, core_cfg, debug)){
567
-		if (cfg_get(core, core_cfg, mem_summary) & 1) {
567
+		if (cfg_get(core, core_cfg, mem_summary) & 2) {
568 568
 			LOG(memlog, "Memory status (shm):\n");
569 569
 			shm_status();
570 570
 		}
571
-		if (cfg_get(core, core_cfg, mem_summary) & 2) {
571
+		if (cfg_get(core, core_cfg, mem_summary) & 8) {
572 572
 			LOG(memlog, "Memory still-in-use summary (shm):\n");
573 573
 			shm_sums();
574 574
 		}