top: do not use #if inside printf, it can be a macro
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
6e8e666bd9
commit
9be4f31da0
24
procps/top.c
24
procps/top.c
@ -522,12 +522,8 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
|
|||||||
/* what info of the processes is shown */
|
/* what info of the processes is shown */
|
||||||
printf(OPT_BATCH_MODE ? "%.*s" : "\e[7m%.*s\e[0m", scr_width,
|
printf(OPT_BATCH_MODE ? "%.*s" : "\e[7m%.*s\e[0m", scr_width,
|
||||||
" PID PPID USER STAT VSZ %MEM"
|
" PID PPID USER STAT VSZ %MEM"
|
||||||
#if ENABLE_FEATURE_TOP_SMP_PROCESS
|
IF_FEATURE_TOP_SMP_PROCESS(" CPU")
|
||||||
" CPU"
|
IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU")
|
||||||
#endif
|
|
||||||
#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
|
|
||||||
" %CPU"
|
|
||||||
#endif
|
|
||||||
" COMMAND");
|
" COMMAND");
|
||||||
lines_rem--;
|
lines_rem--;
|
||||||
|
|
||||||
@ -606,22 +602,14 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
|
|||||||
/* PID PPID USER STAT VSZ %MEM [%CPU] COMMAND */
|
/* PID PPID USER STAT VSZ %MEM [%CPU] COMMAND */
|
||||||
col = snprintf(line_buf, scr_width,
|
col = snprintf(line_buf, scr_width,
|
||||||
"\n" "%5u%6u %-8.8s %s%s" FMT
|
"\n" "%5u%6u %-8.8s %s%s" FMT
|
||||||
#if ENABLE_FEATURE_TOP_SMP_PROCESS
|
IF_FEATURE_TOP_SMP_PROCESS(" %3d")
|
||||||
" %3d"
|
IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(FMT)
|
||||||
#endif
|
|
||||||
#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
|
|
||||||
FMT
|
|
||||||
#endif
|
|
||||||
" ",
|
" ",
|
||||||
s->pid, s->ppid, get_cached_username(s->uid),
|
s->pid, s->ppid, get_cached_username(s->uid),
|
||||||
s->state, vsz_str_buf,
|
s->state, vsz_str_buf,
|
||||||
SHOW_STAT(pmem)
|
SHOW_STAT(pmem)
|
||||||
#if ENABLE_FEATURE_TOP_SMP_PROCESS
|
IF_FEATURE_TOP_SMP_PROCESS(, s->last_seen_on_cpu)
|
||||||
, s->last_seen_on_cpu
|
IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(, SHOW_STAT(pcpu))
|
||||||
#endif
|
|
||||||
#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
|
|
||||||
, SHOW_STAT(pcpu)
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
if ((int)(col + 1) < scr_width)
|
if ((int)(col + 1) < scr_width)
|
||||||
read_cmdline(line_buf + col, scr_width - col, s->pid, s->comm);
|
read_cmdline(line_buf + col, scr_width - col, s->pid, s->comm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user