Browse code

core: added mem_status_mode parameter

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

(cherry picked from commit 8e2d45cb1cd71ec81852a5c0e329c9b3e9d141c5)

Daniel-Constantin Mierla authored on 11/07/2016 14:03:07
Showing 5 changed files
... ...
@@ -352,6 +352,7 @@ MEMDBG		"memdbg"|"mem_dbg"
352 352
 MEMSUM		"mem_summary"
353 353
 MEMSAFETY	"mem_safety"
354 354
 MEMJOIN		"mem_join"
355
+MEMSTATUSMODE		"mem_status_mode"
355 356
 CORELOG		"corelog"|"core_log"
356 357
 SIP_WARNING sip_warning
357 358
 SERVER_SIGNATURE server_signature
... ...
@@ -765,6 +766,7 @@ IMPORTFILE      "import_file"
765 765
 <INITIAL>{MEMSUM}	{ count(); yylval.strval=yytext; return MEMSUM; }
766 766
 <INITIAL>{MEMSAFETY}	{ count(); yylval.strval=yytext; return MEMSAFETY; }
767 767
 <INITIAL>{MEMJOIN}	{ count(); yylval.strval=yytext; return MEMJOIN; }
768
+<INITIAL>{MEMSTATUSMODE}	{ count(); yylval.strval=yytext; return MEMSTATUSMODE; }
768 769
 <INITIAL>{CORELOG}	{ count(); yylval.strval=yytext; return CORELOG; }
769 770
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
770 771
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
... ...
@@ -380,6 +380,7 @@ extern char *default_routename;
380 380
 %token MEMSUM
381 381
 %token MEMSAFETY
382 382
 %token MEMJOIN
383
+%token MEMSTATUSMODE
383 384
 %token CORELOG
384 385
 %token SIP_WARNING
385 386
 %token SERVER_SIGNATURE
... ...
@@ -901,6 +902,8 @@ assign_stm:
901 901
 	| MEMSAFETY EQUAL error { yyerror("int value expected"); }
902 902
 	| MEMJOIN EQUAL intno { default_core_cfg.mem_join=$3; }
903 903
 	| MEMJOIN EQUAL error { yyerror("int value expected"); }
904
+	| MEMSTATUSMODE EQUAL intno { default_core_cfg.mem_status_mode=$3; }
905
+	| MEMSTATUSMODE EQUAL error { yyerror("int value expected"); }
904 906
 	| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
905 907
 	| CORELOG EQUAL error { yyerror("int value expected"); }
906 908
 	| 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_ERR, /*!< latency log */
121 121
 	0, /*!< latency limit db */
... ...
@@ -313,7 +313,7 @@ cfg_def_t core_cfg_def[] = {
313 313
 		"safety level for memory operations"},
314 314
 	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
315 315
 		"join free memory fragments"},
316
-	{"mem_status_all",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316
+	{"mem_status_mode",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317 317
 		"print status for free or all memory fragments"},
318 318
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
319 319
 		"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_log; /*!< log level for latency limits messages */
109 109
 	int latency_limit_db; /*!< alert limit of running db commands */
... ...
@@ -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,