Denys Vlasenko
b96342799f
vmstat: fix I/O, int and ctxt rates: need to be divided by seconds
...
function old new delta
vmstat_main 657 708 +51
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-20 01:34:08 +01:00
Denys Vlasenko
3a8d2db1ce
vmstat: fixes for >4TB memory and long sampling intervals
...
function old new delta
load_row 661 1061 +400
vmstat_main 561 657 +96
.rodata 106716 106746 +30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 526/0) Total: 526 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-20 00:41:47 +01:00
Denys Vlasenko
1ef0c69db4
vmstat: fix "vmstat N 0" to act compatibly (do not print infinitely)
...
function old new delta
vmstat_main 559 561 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-19 02:52:06 +01:00
Denys Vlasenko
afb92adf47
vmstat: smarter handling of header re-printing
...
function old new delta
vmstat_main 230 559 +329
print_row 340 - -340
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 329/-340) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-19 02:16:10 +01:00
Denys Vlasenko
fd2ce3fa27
vmstat: show shorter, human-readable accumulating counts if they grow large
...
function old new delta
print_row 247 340 +93
.rodata 106717 106716 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 93/-1) Total: 92 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-18 18:57:37 +01:00
Denys Vlasenko
6ba6f5f6ab
vmstat: reduce the chances of misaligned columns
...
function old new delta
print_row 215 247 +32
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-18 18:09:12 +01:00
Denys Vlasenko
c21d8ff8c5
vmstat: code shrink
...
function old new delta
load_row 667 661 -6
next_col 105 59 -46
coldescs 239 146 -93
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-145) Total: -145 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-18 16:51:35 +01:00
David Leonard
c385dac31c
procps: new applet: vmstat
...
Adds a compact vmstat applet that matches the default behaviour
of procps's vmstat.
function old new delta
load_row - 667 +667
.rodata 106441 106717 +276
coldescs - 239 +239
vmstat_main - 230 +230
print_row - 215 +215
next_col - 105 +105
find_col - 78 +78
packed_usage 35828 35868 +40
applet_names 2849 2856 +7
applet_main 1640 1644 +4
applet_install_loc 205 206 +1
------------------------------------------------------------------------------
(add/remove: 7/0 grow/shrink: 5/0 up/down: 1862/0) Total: 1862 bytes
Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2026-01-18 10:58:46 +01:00
Denys Vlasenko
4ee218a2d2
pgrep/pkill: fix -x to also match comm field
...
When running `pgrep -x example` against a process `/bin/example --arg`,
BusyBox fails to match, while GNU pgrep succeeds. The reason is that the
comparison is done only against the full argv[0] rather than comm. This
patch changes pgrep -x to also try /proc/[pid]/comm for exact matching.
function old new delta
pgrep_main 681 670 -11
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-11-08 07:42:34 +01:00
Denys Vlasenko
0b05a4e71e
top,pmap: speed up /smaps parsing
...
function old new delta
procps_read_smaps 515 529 +14
procps_get_maps 685 665 -20
.rodata 105847 105820 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 14/-47) Total: -33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-06 14:42:06 +02:00
Denys Vlasenko
40c2d01da2
libbb: make read_cmdline() replace chars 1..31 with '?', not space
...
Space was too inconspicuous on output
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-06 14:02:05 +02:00
Denys Vlasenko
8bde71eb15
top: simplify command line reading
...
function old new delta
cmdline_to_line_buf_and_print - 48 +48
read_cmdline 326 327 +1
display_topmem_process_list 523 505 -18
display_process_list 1186 1161 -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 49/-43) Total: 6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-06 00:42:05 +02:00
Denys Vlasenko
1bd8d714ca
top: disentangle printing logic
...
function old new delta
print_line_buf - 78 +78
print_line_bold - 50 +50
top_main 1043 1091 +48
handle_input 708 714 +6
do_stats 186 192 +6
.rodata 115543 115526 -17
display_topmem_process_list 748 523 -225
display_process_list 1432 1186 -246
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/3 up/down: 188/-488) Total: -300 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-06 00:05:44 +02:00
Denys Vlasenko
2363938883
top: consistently NOT use the last column of the display
...
function old new delta
.rodata 115537 115543 +6
top_main 1047 1043 -4
display_process_list 1459 1432 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 6/-31) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 19:37:43 +02:00
Denys Vlasenko
5a8c03039f
pmap: increase max handled command line length to 4k
...
function old new delta
procps_get_maps 181 779 +598
read_smaps 563 - -563
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 598/-563) Total: 35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 14:35:14 +02:00
Denys Vlasenko
d16bde623c
top,pmap: do not use common code for reading /proc/PID/smaps
...
The logic is in fact quite far from common.
While at it, stop accounting "---p" mappings as mapped (e.g. VSZ in top).
Nothing is mapped there (why would kernel waste RAM to map pages
which can't be accessed?).
function old new delta
read_smaps - 562 +562
read_cmdline 315 326 +11
print_smaprec 97 101 +4
procps_scan 1219 1211 -8
.rodata 115541 115533 -8
skip_whitespace_if_prefixed_with 25 - -25
procps_read_smaps 864 577 -287
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/3 up/down: 577/-328) Total: 249 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 14:21:51 +02:00
Denys Vlasenko
58b2353baa
top: improve response time to keyboard input
...
function old new delta
handle_input 674 708 +34
top_main 1019 1047 +28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 62/0) Total: 62 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 04:30:59 +02:00
Denys Vlasenko
3aa2bee269
top: reduce flicker: redraw screen with "clear to EOL" commands, not one "clear screen"
...
function old new delta
display_topmem_process_list 680 748 +68
display_process_list 1403 1459 +56
.rodata 115512 115541 +29
top_main 1014 1019 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0) Total: 158 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 03:40:36 +02:00
Denys Vlasenko
1044533ea9
top: make uppercase 'S' walk topmem in opposite direction
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 03:13:01 +02:00
Denys Vlasenko
d647d8aaba
top: show RSS instead of VSF, virtual mapped size is often meaningless
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 03:07:40 +02:00
Denys Vlasenko
c229982b33
top: fix display of very large VSZ
...
function old new delta
display_process_list 1366 1403 +37
handle_input 628 636 +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 45/0) Total: 45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 02:57:05 +02:00
Denys Vlasenko
c1b5c35246
top: do not rescan processes on second 's'
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-08-05 01:25:01 +02:00
Denys Vlasenko
b20b3790b4
powertop: code shrink
...
function old new delta
print_intel_cstates 477 475 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-07-13 11:46:15 +02:00
Denys Vlasenko
28f4126093
top: improve large PID display in memory ('s') mode
...
Display VSZ[RW] fields in more compact form if PID is wider.
function old new delta
display_topmem_process_list 564 614 +50
ulltoa5_and_space - 14 +14
ulltoa6_and_space 14 - -14
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 64/-14) Total: 50 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-11-23 01:18:02 +01:00
Denys Vlasenko
5353df91cb
Update applet size estimates
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-07-10 17:25:21 +02:00
Denys Vlasenko
648f506949
libbb: code shrink: introduce and use [_]exit_FAILURE()
...
function old new delta
exit_FAILURE - 7 +7
_exit_FAILURE - 7 +7
run 198 199 +1
restore_state_and_exit 114 115 +1
xbsd_write_bootstrap 399 397 -2
vfork_compressor 209 207 -2
sig_handler 12 10 -2
serial_ctl 154 152 -2
parse_args 1169 1167 -2
onintr 21 19 -2
make_new_session 493 491 -2
login_main 988 986 -2
gotsig 35 33 -2
do_iplink 1315 1313 -2
addgroup_main 397 395 -2
inetd_main 1911 1908 -3
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/12 up/down: 16/-25) Total: -9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-06-15 11:55:56 +02:00
Denys Vlasenko
c6058d221a
nmeter: improve %T fractionals display
...
function old new delta
nmeter_main 751 786 +35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-07 18:35:22 +02:00
Denys Vlasenko
05f2bedaeb
ash: sleep builtin with no arguments should not exit
...
function old new delta
sleep_main 116 143 +27
.rodata 105245 105268 +23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 50/0) Total: 50 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-03 19:54:42 +02:00
Denys Vlasenko
669c40ed8e
top: stop using div() from libc, compilers now do it better
...
function old new delta
div 23 - -23
display_process_list 1237 1178 -59
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-82) Total: -82 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-02-13 15:05:19 +01:00
Denys Vlasenko
c2739e11de
nmeter: increase maximum /proc file size (needed for large machines)
...
function old new delta
get_file 185 201 +16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-24 12:47:32 +01:00
Denys Vlasenko
99476502f9
Remove "select PLATFORM_LINUX"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-29 14:14:06 +01:00
Samuel Thibault
77216c368f
Fix non-Linux builds
...
Various tools are Linuxish and should thus only attempted to build on
Linux only. Some features are also Linux-only.
Also, libresolv is used on all GNU platforms, notably GNU/Hurd and
GNU/kfreeBSD.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-29 14:10:22 +01:00
Louis Sautier
707a7ef4c7
pkill: add -e to display the name and PID of the process being killed
...
This mimics the behaviour of pkill -e / --echo from procps.
function old new delta
.rodata 105179 105200 +21
packed_usage 34523 34516 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-7) Total: 14 bytes
Signed-off-by: Louis Sautier <sautier.louis@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-10-14 14:33:34 +02:00
Denys Vlasenko
fe73c8d557
*: style fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-30 16:41:17 +02:00
Denys Vlasenko
8d67007a4d
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>
2022-05-12 11:44:47 +02:00
Denys Vlasenko
1099a27696
top: code shrink
...
function old new delta
display_process_list 1186 1168 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 14:04:34 +02:00
Denys Vlasenko
69f82e305b
top: code shrink
...
function old new delta
display_process_list 1191 1186 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 13:51:09 +02:00
Denys Vlasenko
294881d2e9
top: fix display of large PID/PPID
...
function old new delta
display_process_list 1077 1191 +114
.rodata 104803 104807 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 118/0) Total: 118 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 12:56:28 +02:00
Denys Vlasenko
987be932ed
*: slap on a few ALIGN_PTR where appropriate
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-06 20:07:12 +01:00
Denys Vlasenko
12566e7f9b
ash,hush: fix handling of SIGINT while waiting for interactive input
...
function old new delta
lineedit_read_key 160 237 +77
__pgetc 522 589 +67
fgetc_interactive 244 309 +65
safe_read_key - 39 +39
read_key 588 607 +19
record_pending_signo 23 32 +9
signal_handler 75 81 +6
.rodata 104312 104309 -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/1 up/down: 282/-3) Total: 279 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-17 11:46:23 +01:00
Denys Vlasenko
524fecf7c3
nmeter: %[md] %[mw] - dirty file-backed pages, writeback pages
...
function old new delta
collect_mem 333 387 +54
.rodata 104369 104380 +11
packed_usage 34184 34175 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 65/-9) Total: 56 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-11 19:32:16 +01:00
Denys Vlasenko
89092c61bc
powertop: fix cpuid asm: ebx saving/restoring is properly done by gcc
...
function old new delta
print_intel_cstates 481 477 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-07 01:33:46 +01:00
Denys Vlasenko
94c78aa0b9
config system: move some options closer to relevalnt tool subdirectories
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-12 13:23:29 +02:00
Denys Vlasenko
eb048a450c
ps: fix -o pid=PID,args interpreting entire "PID,args" as header
...
procps-ng 3.3.15 does not do this.
(It could, allowing commas in headers and requiring
"ps -opid=PID -oargs" form for this case, but it does not).
function old new delta
parse_o 167 190 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-07 21:55:16 +02:00
YU Jincheng
1f925038ab
*: generalize "const trick"
...
While at it, change all "__asm__" to "asm"
Co-authored-by: canyie <31466456+canyie@users.noreply.github.com>
Signed-off-by: YU Jincheng <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-07 15:22:35 +02:00
Denys Vlasenko
62d5a1e56f
tar,smemcap: commonalyze checksumming code for tar header
...
function old new delta
chksum_and_xwrite_tar_header - 99 +99
writeheader 280 199 -81
chksum_and_xwrite 102 - -102
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/1 up/down: 99/-183) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-20 17:58:49 +02:00
Denys Vlasenko
dc30f3dce2
free: implement -h
...
function old new delta
.rodata 103331 103363 +32
packed_usage 33652 33654 +2
free_main 657 588 -69
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 34/-69) Total: -35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-18 12:08:02 +02:00
Denys Vlasenko
57be5daa40
lsof: print fd# too
...
function old new delta
lsof_main 179 188 +9
.rodata 103194 103187 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-16 12:49:15 +02:00
Denys Vlasenko
1f60d88cf6
*: more --help tweaks
...
function old new delta
packed_usage 33552 33541 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-15 10:00:18 +02:00
Denys Vlasenko
e2b9215868
*: --help tweaks
...
function old new delta
packed_usage 33589 33552 -37
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-14 20:47:20 +02:00