Browse code

core:mem: short status dumping

- patch by Andrade Ricardo, on Aug 1, 2011

Daniel-Constantin Mierla authored on 26/08/2011 07:32:51
Showing 5 changed files
... ...
@@ -120,7 +120,7 @@ struct cfg_group_core default_core_cfg = {
120 120
 	0,  /*!< force_rport */
121 121
 	L_DBG, /*!< memlog */
122 122
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123
-		4 pkg_sums, 8 shm_sums */
123
+		4 pkg_sums, 8 shm_sums, 16 short_status */
124 124
 	L_ERR /*!< corelog */
125 125
 };
126 126
 
... ...
@@ -301,13 +301,14 @@ cfg_def_t core_cfg_def[] = {
301 301
 		"force rport for all the received messages" },
302 302
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
303 303
 		"log level for memory status/summary information"},
304
-	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 15, 0, 0,
304
+	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 31, 0, 0,
305 305
 		"memory debugging information displayed on exit (flags): "
306 306
 		" 0 - off,"
307 307
 		" 1 - dump all the pkg used blocks (status),"
308 308
 		" 2 - dump all the shm used blocks (status),"
309 309
 		" 4 - summary of pkg used blocks,"
310
-		" 8 - summary of shm used blocks" },
310
+		" 8 - summary of shm used blocks,"
311
+		" 16 - short status instead of dump" },
311 312
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
312 313
 		"log level for non-critical core error messages"},
313 314
 	{0, 0, 0, 0, 0, 0}
... ...
@@ -511,10 +511,12 @@
511 511
         memory debugging information displayed on exit (flags):  0 -
512 512
         off, 1 - dump all the pkg used blocks (status), 2 - dump all
513 513
         the shm used blocks (status), 4 - summary of pkg used blocks, 8
514
-        - summary of shm used blocks.
514
+        - summary of shm used blocks, 16 - show only summary of used
515
+	blocks instead of full dump (to use in conjuntion with flags 1
516
+	and 2).
515 517
     </para>
516 518
     <para>Default value: 3.</para>
517
-    <para>Range: 0 - 15.</para>
519
+    <para>Range: 0 - 31.</para>
518 520
     <para>Type: integer.</para>
519 521
     <para>
520 522
     </para>
... ...
@@ -667,8 +667,10 @@ void fm_status(struct fm_block* qm)
667 667
 	int unused;
668 668
 	unsigned long size;
669 669
 	int memlog;
670
+	int mem_summary;
670 671
 
671 672
 	memlog=cfg_get(core, core_cfg, memlog);
673
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
672 674
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ", "fm_status (%p):\n", qm);
673 675
 	if (!qm) return;
674 676
 
... ...
@@ -681,6 +683,9 @@ void fm_status(struct fm_block* qm)
681 681
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ",
682 682
 			" max used (+overhead)= %lu\n", qm->max_real_used);
683 683
 #endif
684
+
685
+	if (mem_summary & 16) return;
686
+
684 687
 	/*
685 688
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ", "dumping all fragments:\n");
686 689
 	for (f=qm->first_frag, i=0;((char*)f<(char*)qm->last_frag) && (i<10);
... ...
@@ -971,14 +971,19 @@ void sfm_status(struct sfm_block* qm)
971 971
 	unsigned long size;
972 972
 	int k;
973 973
 	int memlog;
974
+	int mem_summary;
974 975
 
975 976
 #warning "ll_status doesn't work (might crash if used)"
976 977
 
977 978
 	memlog=cfg_get(core, core_cfg, memlog);
979
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
978 980
 	LOG(memlog, "sfm_status (%p):\n", qm);
979 981
 	if (!qm) return;
980 982
 
981 983
 	LOG(memlog, " heap size= %ld\n", qm->size);
984
+
985
+	if (mem_summary & 16) return;
986
+
982 987
 	LOG(memlog, "dumping free list:\n");
983 988
 	for(h=0,i=0,size=0;h<=sfm_max_hash;h++){
984 989
 		SFM_MAIN_HASH_LOCK(qm, h);
... ...
@@ -716,9 +716,10 @@ void qm_status(struct qm_block* qm)
716 716
 	int h;
717 717
 	int unused;
718 718
 	int memlog;
719
-
719
+	int mem_summary;
720 720
 
721 721
 	memlog=cfg_get(core, core_cfg, memlog);
722
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
722 723
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ", "(%p):\n", qm);
723 724
 	if (!qm) return;
724 725
 
... ...
@@ -730,6 +731,8 @@ void qm_status(struct qm_block* qm)
730 730
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
731 731
 			"max used (+overhead)= %lu\n", qm->max_real_used);
732 732
 	
733
+	if (mem_summary & 16) return;
734
+
733 735
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
734 736
 			"dumping all alloc'ed. fragments:\n");
735 737
 	for (f=qm->first_frag, i=0;(char*)f<(char*)qm->last_frag_end;f=FRAG_NEXT(f)