Skip to content

Commit

Permalink
core: added mem_status_mode parameter
Browse files Browse the repository at this point in the history
- if set to 1, qm allocator dumps used fragments in memory status
  • Loading branch information
miconda committed Jul 11, 2016
1 parent 5be968a commit 8e2d45c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cfg.lex
Expand Up @@ -353,6 +353,7 @@ MEMDBG "memdbg"|"mem_dbg"
MEMSUM "mem_summary"
MEMSAFETY "mem_safety"
MEMJOIN "mem_join"
MEMSTATUSMODE "mem_status_mode"
CORELOG "corelog"|"core_log"
SIP_WARNING sip_warning
SERVER_SIGNATURE server_signature
Expand Down Expand Up @@ -770,6 +771,7 @@ IMPORTFILE "import_file"
<INITIAL>{MEMSUM} { count(); yylval.strval=yytext; return MEMSUM; }
<INITIAL>{MEMSAFETY} { count(); yylval.strval=yytext; return MEMSAFETY; }
<INITIAL>{MEMJOIN} { count(); yylval.strval=yytext; return MEMJOIN; }
<INITIAL>{MEMSTATUSMODE} { count(); yylval.strval=yytext; return MEMSTATUSMODE; }
<INITIAL>{CORELOG} { count(); yylval.strval=yytext; return CORELOG; }
<INITIAL>{SIP_WARNING} { count(); yylval.strval=yytext; return SIP_WARNING; }
<INITIAL>{USER} { count(); yylval.strval=yytext; return USER; }
Expand Down
3 changes: 3 additions & 0 deletions cfg.y
Expand Up @@ -382,6 +382,7 @@ extern char *default_routename;
%token MEMSUM
%token MEMSAFETY
%token MEMJOIN
%token MEMSTATUSMODE
%token CORELOG
%token SIP_WARNING
%token SERVER_SIGNATURE
Expand Down Expand Up @@ -907,6 +908,8 @@ assign_stm:
| MEMSAFETY EQUAL error { yyerror("int value expected"); }
| MEMJOIN EQUAL intno { default_core_cfg.mem_join=$3; }
| MEMJOIN EQUAL error { yyerror("int value expected"); }
| MEMSTATUSMODE EQUAL intno { default_core_cfg.mem_status_mode=$3; }
| MEMSTATUSMODE EQUAL error { yyerror("int value expected"); }
| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
| CORELOG EQUAL error { yyerror("int value expected"); }
| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
Expand Down
4 changes: 2 additions & 2 deletions cfg_core.c
Expand Up @@ -115,7 +115,7 @@ struct cfg_group_core default_core_cfg = {
4 pkg_sums, 8 shm_sums, 16 short_status */
0, /*!< mem_safety - 0 disabled */
0, /*!< mem_join - 0 disabled */
0, /*!< mem_status_all - 0 only free fragments, 1 all fragements */
0, /*!< mem_status_mode - 0 only free fragments, 1 all fragements */
L_ERR, /*!< corelog */
L_DBG, /*!< latency cfg log */
L_ERR, /*!< latency log */
Expand Down Expand Up @@ -314,7 +314,7 @@ cfg_def_t core_cfg_def[] = {
"safety level for memory operations"},
{"mem_join", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
"join free memory fragments"},
{"mem_status_all", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
{"mem_status_mode", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
"print status for free or all memory fragments"},
{"corelog", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
"log level for non-critical core error messages"},
Expand Down
2 changes: 1 addition & 1 deletion cfg_core.h
Expand Up @@ -103,7 +103,7 @@ struct cfg_group_core {
int mem_summary; /*!< display memory status/summary info on exit */
int mem_safety; /*!< memory safety control option */
int mem_join; /*!< memory free fragments join option */
int mem_status_all; /*!< memory status printed for free/all fragments */
int mem_status_mode; /*!< memory status printed for free/all fragments */
int corelog; /*!< log level for non-critcal core error messages */
int latency_cfg_log; /*!< log level for printing latency of routing blocks */
int latency_log; /*!< log level for latency limits messages */
Expand Down
2 changes: 1 addition & 1 deletion mem/q_malloc.c
Expand Up @@ -793,7 +793,7 @@ void qm_status(void* qmp)
"dumping all alloc'ed. fragments:\n");
for (f=qm->first_frag, i=0;(char*)f<(char*)qm->last_frag_end;f=FRAG_NEXT(f)
,i++){
if ((! f->u.is_free) || (cfg_get(core, core_cfg, mem_status_all)!=0)){
if ((! f->u.is_free) || (cfg_get(core, core_cfg, mem_status_mode)!=0)){
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
" %3d. %c address=%p frag=%p size=%lu used=%d\n",
i,
Expand Down

0 comments on commit 8e2d45c

Please sign in to comment.