Prechádzať zdrojové kódy

core:mem: short status dumping

- patch by Andrade Ricardo, on Aug 1, 2011
Daniel-Constantin Mierla 14 rokov pred
rodič
commit
c191f7b603
5 zmenil súbory, kde vykonal 22 pridanie a 6 odobranie
  1. 4 3
      cfg_core.c
  2. 4 2
      doc/cfg_list/docbook/cfg_core.xml
  3. 5 0
      mem/f_malloc.c
  4. 5 0
      mem/ll_malloc.c
  5. 4 1
      mem/q_malloc.c

+ 4 - 3
cfg_core.c

@@ -120,7 +120,7 @@ struct cfg_group_core default_core_cfg = {
 	0,  /*!< force_rport */
 	L_DBG, /*!< memlog */
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
-		4 pkg_sums, 8 shm_sums */
+		4 pkg_sums, 8 shm_sums, 16 short_status */
 	L_ERR /*!< corelog */
 };
 
@@ -301,13 +301,14 @@ 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, 15, 0, 0,
+	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 31, 0, 0,
 		"memory debugging information displayed on exit (flags): "
 		" 0 - off,"
 		" 1 - dump all the pkg used blocks (status),"
 		" 2 - dump all the shm used blocks (status),"
 		" 4 - summary of pkg used blocks,"
-		" 8 - summary of shm used blocks" },
+		" 8 - summary of shm used blocks,"
+		" 16 - short status instead of dump" },
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
 		"log level for non-critical core error messages"},
 	{0, 0, 0, 0, 0, 0}

+ 4 - 2
doc/cfg_list/docbook/cfg_core.xml

@@ -511,10 +511,12 @@
         memory debugging information displayed on exit (flags):  0 -
         off, 1 - dump all the pkg used blocks (status), 2 - dump all
         the shm used blocks (status), 4 - summary of pkg used blocks, 8
-        - summary of shm used blocks.
+        - summary of shm used blocks, 16 - show only summary of used
+	blocks instead of full dump (to use in conjuntion with flags 1
+	and 2).
     </para>
     <para>Default value: 3.</para>
-    <para>Range: 0 - 15.</para>
+    <para>Range: 0 - 31.</para>
     <para>Type: integer.</para>
     <para>
     </para>

+ 5 - 0
mem/f_malloc.c

@@ -667,8 +667,10 @@ void fm_status(struct fm_block* qm)
 	int unused;
 	unsigned long size;
 	int memlog;
+	int mem_summary;
 
 	memlog=cfg_get(core, core_cfg, memlog);
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ", "fm_status (%p):\n", qm);
 	if (!qm) return;
 
@@ -681,6 +683,9 @@ void fm_status(struct fm_block* qm)
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ",
 			" max used (+overhead)= %lu\n", qm->max_real_used);
 #endif
+
+	if (mem_summary & 16) return;
+
 	/*
 	LOG_(DEFAULT_FACILITY, memlog, "fm_status: ", "dumping all fragments:\n");
 	for (f=qm->first_frag, i=0;((char*)f<(char*)qm->last_frag) && (i<10);

+ 5 - 0
mem/ll_malloc.c

@@ -971,14 +971,19 @@ void sfm_status(struct sfm_block* qm)
 	unsigned long size;
 	int k;
 	int memlog;
+	int mem_summary;
 
 #warning "ll_status doesn't work (might crash if used)"
 
 	memlog=cfg_get(core, core_cfg, memlog);
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
 	LOG(memlog, "sfm_status (%p):\n", qm);
 	if (!qm) return;
 
 	LOG(memlog, " heap size= %ld\n", qm->size);
+
+	if (mem_summary & 16) return;
+
 	LOG(memlog, "dumping free list:\n");
 	for(h=0,i=0,size=0;h<=sfm_max_hash;h++){
 		SFM_MAIN_HASH_LOCK(qm, h);

+ 4 - 1
mem/q_malloc.c

@@ -716,9 +716,10 @@ void qm_status(struct qm_block* qm)
 	int h;
 	int unused;
 	int memlog;
-
+	int mem_summary;
 
 	memlog=cfg_get(core, core_cfg, memlog);
+	mem_summary=cfg_get(core, core_cfg, mem_summary);
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ", "(%p):\n", qm);
 	if (!qm) return;
 
@@ -730,6 +731,8 @@ void qm_status(struct qm_block* qm)
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
 			"max used (+overhead)= %lu\n", qm->max_real_used);
 	
+	if (mem_summary & 16) return;
+
 	LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
 			"dumping all alloc'ed. fragments:\n");
 	for (f=qm->first_frag, i=0;(char*)f<(char*)qm->last_frag_end;f=FRAG_NEXT(f)