Browse code

core: added mem_status_mode parameter

- if set to 1, qm allocator dumps used fragments in memory status

Daniel-Constantin Mierla authored on 11/07/2016 14:03:07
Showing 5 changed files
... ...
@@ -353,6 +353,7 @@ MEMDBG		"memdbg"|"mem_dbg"
353 353
 MEMSUM		"mem_summary"
354 354
 MEMSAFETY	"mem_safety"
355 355
 MEMJOIN		"mem_join"
356
+MEMSTATUSMODE		"mem_status_mode"
356 357
 CORELOG		"corelog"|"core_log"
357 358
 SIP_WARNING sip_warning
358 359
 SERVER_SIGNATURE server_signature
... ...
@@ -770,6 +771,7 @@ IMPORTFILE      "import_file"
770 771
 <INITIAL>{MEMSUM}	{ count(); yylval.strval=yytext; return MEMSUM; }
771 772
 <INITIAL>{MEMSAFETY}	{ count(); yylval.strval=yytext; return MEMSAFETY; }
772 773
 <INITIAL>{MEMJOIN}	{ count(); yylval.strval=yytext; return MEMJOIN; }
774
+<INITIAL>{MEMSTATUSMODE}	{ count(); yylval.strval=yytext; return MEMSTATUSMODE; }
773 775
 <INITIAL>{CORELOG}	{ count(); yylval.strval=yytext; return CORELOG; }
774 776
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
775 777
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
... ...
@@ -382,6 +382,7 @@ extern char *default_routename;
382 382
 %token MEMSUM
383 383
 %token MEMSAFETY
384 384
 %token MEMJOIN
385
+%token MEMSTATUSMODE
385 386
 %token CORELOG
386 387
 %token SIP_WARNING
387 388
 %token SERVER_SIGNATURE
... ...
@@ -907,6 +908,8 @@ assign_stm:
907 908
 	| MEMSAFETY EQUAL error { yyerror("int value expected"); }
908 909
 	| MEMJOIN EQUAL intno { default_core_cfg.mem_join=$3; }
909 910
 	| MEMJOIN EQUAL error { yyerror("int value expected"); }
911
+	| MEMSTATUSMODE EQUAL intno { default_core_cfg.mem_status_mode=$3; }
912
+	| MEMSTATUSMODE EQUAL error { yyerror("int value expected"); }
910 913
 	| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
911 914
 	| CORELOG EQUAL error { yyerror("int value expected"); }
912 915
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
... ...
@@ -115,7 +115,7 @@ struct cfg_group_core default_core_cfg = {
115 115
 		4 pkg_sums, 8 shm_sums, 16 short_status */
116 116
 	0, /*!< mem_safety - 0 disabled */
117 117
 	0, /*!< mem_join - 0 disabled */
118
-	0, /*!< mem_status_all - 0 only free fragments, 1 all fragements */
118
+	0, /*!< mem_status_mode - 0 only free fragments, 1 all fragements */
119 119
 	L_ERR, /*!< corelog */
120 120
 	L_DBG, /*!< latency cfg log */
121 121
 	L_ERR, /*!< latency log */
... ...
@@ -314,7 +314,7 @@ cfg_def_t core_cfg_def[] = {
314 314
 		"safety level for memory operations"},
315 315
 	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316 316
 		"join free memory fragments"},
317
-	{"mem_status_all",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317
+	{"mem_status_mode",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318 318
 		"print status for free or all memory fragments"},
319 319
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
320 320
 		"log level for non-critical core error messages"},
... ...
@@ -103,7 +103,7 @@ struct cfg_group_core {
103 103
 	int mem_summary; /*!< display memory status/summary info on exit */
104 104
 	int mem_safety; /*!< memory safety control option */
105 105
 	int mem_join; /*!< memory free fragments join option */
106
-	int mem_status_all; /*!< memory status printed for free/all fragments */
106
+	int mem_status_mode; /*!< memory status printed for free/all fragments */
107 107
 	int corelog; /*!< log level for non-critcal core error messages */
108 108
 	int latency_cfg_log; /*!< log level for printing latency of routing blocks */
109 109
 	int latency_log; /*!< log level for latency limits messages */
... ...
@@ -793,7 +793,7 @@ void qm_status(void* qmp)
793 793
 			"dumping all alloc'ed. fragments:\n");
794 794
 	for (f=qm->first_frag, i=0;(char*)f<(char*)qm->last_frag_end;f=FRAG_NEXT(f)
795 795
 			,i++){
796
-		if ((! f->u.is_free) || (cfg_get(core, core_cfg, mem_status_all)!=0)){
796
+		if ((! f->u.is_free) || (cfg_get(core, core_cfg, mem_status_mode)!=0)){
797 797
 			LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
798 798
 					"   %3d. %c  address=%p frag=%p size=%lu used=%d\n",
799 799
 				i,