diff options
author | Denys Vlasenko | 2022-05-12 11:44:47 +0200 |
---|---|---|
committer | Denys Vlasenko | 2022-05-12 11:44:47 +0200 |
commit | 8d67007a4dedef77dd0cf757bcc0e6fbee267ced (patch) | |
tree | 5a9b2141b8b7a7554836115f023841458657e9c9 /procps | |
parent | b9c2108b26ad1fe4634c250850a4abadff26c76e (diff) | |
download | busybox-8d67007a4dedef77dd0cf757bcc0e6fbee267ced.zip busybox-8d67007a4dedef77dd0cf757bcc0e6fbee267ced.tar.gz |
top: improve large PID display in memory ('s') mode
function old new delta
display_topmem_process_list 530 564 +34
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r-- | procps/top.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/procps/top.c b/procps/top.c index 744f20e..ff77542 100644 --- a/procps/top.c +++ b/procps/top.c @@ -879,8 +879,11 @@ static NOINLINE void display_topmem_process_list(int lines_rem, int scr_width) lines_rem = ntop - G_scroll_ofs; while (--lines_rem >= 0) { /* PID VSZ VSZRW RSS (SHR) DIRTY (SHR) COMMAND */ - ulltoa6_and_space(s->pid , &line_buf[0*6]); + int n = sprintf(line_buf, "%5u ", s->pid); ulltoa6_and_space(s->vsz , &line_buf[1*6]); + if (n > 7 || (n == 7 && line_buf[6] != ' ')) + /* PID and VSZ are clumped together, truncate PID */ + line_buf[5] = '.'; ulltoa6_and_space(s->vszrw , &line_buf[2*6]); ulltoa6_and_space(s->rss , &line_buf[3*6]); ulltoa6_and_space(s->rss_sh , &line_buf[4*6]); |