aboutsummaryrefslogtreecommitdiff
path: root/procps/top.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: use ESC define instead of "\033"; use ESC[m instead of ESC[0mDenys Vlasenko2017-09-131-4/+5
| | | | | | | | text data bss dec hex filename 922535 481 6832 929848 e3038 busybox_old 922534 481 6832 929847 e3037 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: stop using atexit in non-debug build: saves ~260 in bss with muslDenys Vlasenko2017-08-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | "builtin" below is atexit's 32-element global array of functions to call. function old new delta top_main 879 889 +10 launch_helper 185 193 +8 powertop_main 1555 1559 +4 sed_main 651 650 -1 slot 4 - -4 call 4 - -4 atexit 23 - -23 kill_helper 31 - -31 __funcs_on_exit 120 - -120 __cxa_atexit 168 - -168 builtin 260 - -260 ------------------------------------------------------------------------------ (add/remove: 0/8 grow/shrink: 3/1 up/down: 22/-611) Total: -589 bytes text data bss dec hex filename 912364 563 6132 919059 e0613 busybox_old 912035 563 5844 918442 e03aa busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: switch to malloced "globals".Denys Vlasenko2017-08-161-7/+6
| | | | | | | | | | | | | | | | | | | | | This seems to be more efficient: function old new delta clearmems - 28 +28 display_process_list 1001 1018 +17 read_cpu_jiffy 171 177 +6 do_stats 194 198 +4 reset_term 20 23 +3 topmem_sort 63 65 +2 mult_lvl_cmp 44 45 +1 get_jiffy_counts 247 248 +1 display_topmem_process_list 549 546 -3 top_main 912 879 -33 handle_input 630 549 -81 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/3 up/down: 62/-117) Total: -55 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* getopt32: factor out code to treat all args as optionsDenys Vlasenko2017-08-041-3/+2
| | | | | | | | | | | | | Working towards making getopt32() xmalloc-free function old new delta make_all_argv_opts - 58 +58 top_main 914 912 -2 getopt32 1517 1458 -59 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/2 up/down: 58/-61) Total: -3 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-211-15/+15
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Move FEATURE_USE_TERMIOS config option to two applets which use itDenys Vlasenko2017-01-111-10/+18
| | | | | | No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: consolidate the code to set termios unbuffered modeDenys Vlasenko2017-01-111-8/+2
| | | | | | | | | | | | | | | | function old new delta set_termios_to_raw - 116 +116 count_lines 72 74 +2 powertop_main 1458 1430 -28 top_main 943 914 -29 more_main 759 714 -45 fsck_minix_main 2969 2921 -48 conspy_main 1197 1135 -62 rawmode 99 36 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: FEATURE_USE_TERMIOS shouldn't control reading of screen sizeDenys Vlasenko2017-01-111-4/+0
| | | | | | It controls whether we take input. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: fix help text: with !TERMIOS, no keys are affected top outputDenys Vlasenko2016-12-031-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Convert all procps/* applets to "new style" applet definitionsDenys Vlasenko2016-11-231-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: move free(prev_hist) out of signal pathDenys Vlasenko2016-08-191-6/+6
| | | | | | | It was seen being called recursively on repeated signals, leading to double free Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: slap on a few ALIGN1/2s where appropriateDenys Vlasenko2016-04-221-3/+3
| | | | | | | | | | The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" text data bss dec hex filename 829901 4086 1904 835891 cc133 busybox_before 829665 4086 1904 835655 cc047 busybox Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: add most of the required setup_common_bufsiz() callsDenys Vlasenko2016-04-211-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko2016-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: make sort field for 's' mode less confusingDenys Vlasenko2015-10-141-13/+14
| | | | | | | function old new delta display_topmem_process_list 542 565 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: more BUILD_BUG_ON conversionsDenys Vlasenko2015-10-131-5/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: fix memset length (sizeof(ptr) vs sizeof(array) problem)Denys Vlasenko2014-07-291-2/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: fix and merge code to parse /proc/meminfoTimo Teräs2014-07-271-110/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | display_header() code to parse meminfo as is was buggy: - uninitialized variables were used if meminfo was not as expected - meminfo parsing failed on new kernels (3.14+) as new field 'MemAvailable' was introduced between MemFree and Buffers - shared memory was handled only for ancient kernels (2.4.x and earlier) as result Buffers and shared memory fields were shown with bogus values on current kernels. The new code does not try to parse the old style summary header, as the separated fields are always present (it saves code size). Additionally, both Shmem (2.6+) and MemShared (2.4 and earlier) fields are now parsed and summed for shared memory usage; as only one of them exists depending on kernel version. display_topmem_header() parses also meminfo so this makes it use the same code for code shrink. function old new delta display_header - 681 +681 display_topmem_process_list 465 684 +219 parse_meminfo - 189 +189 static.fields - 106 +106 static.match 132 - -132 .rodata 120254 120117 -137 display_topmem_header 513 - -513 display_process_list 1705 667 -1038 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 1/2 up/down: 1195/-1820) Total: -625 bytes Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top.c: fix compilation warningsBartosz Golaszewski2014-01-201-5/+0
| | | | | | | pfd[1] is unused Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Use unsigned printf/scanf conversion where more appropriateDenys Vlasenko2013-11-291-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: fix breakage introduced by previous commitDenys Vlasenko2013-09-061-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make smart_ulltoa return pointer to end (allows for code shink in callers)Denys Vlasenko2013-09-061-2/+1
| | | | | | | | | | | | | function old new delta smart_ulltoa5 405 408 +3 smart_ulltoa4 273 276 +3 list_table 1113 1114 +1 scale 36 34 -2 put_lu 55 53 -2 ulltoa6_and_space 19 14 -5 powertop_main 1470 1461 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: reuse more stringsDenys Vlasenko2013-01-221-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesDenys Vlasenko2013-01-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: correctness/size tweaks in signal-related helpersDenys Vlasenko2012-09-271-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: do not touch stdin if -bDenys Vlasenko2012-09-261-10/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: fix build failure in !USE_TERMIOS caseDenys Vlasenko2012-09-251-17/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: implement scrolling up/down (_very_ useful)Denys Vlasenko2012-09-211-20/+110
| | | | | | | | | | | | | function old new delta handle_input 494 564 +70 top_main 928 947 +19 display_topmem_process_list 363 381 +18 display_process_list 1442 1453 +11 clearmems 38 28 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 118/-10) Total: 108 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add INIT_G()'s. No code changes.Denys Vlasenko2011-09-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: display sort indicator in memory displayDenys Vlasenko2011-05-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: better indicator of selected field in mem viewDenys Vlasenko2011-05-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: another scripting improvementDenys Vlasenko2011-05-061-16/+27
| | | | | | | function old new delta handle_input 492 493 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: make it possible to feed commands via pipeDenys Vlasenko2011-05-061-110/+155
| | | | | | | | | | | | function old new delta handle_input - 492 +492 mult_lvl_cmp 38 49 +11 packed_usage 28247 28257 +10 top_main 1345 928 -417 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 513/-417) Total: 96 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: replace %MEM with %VSZ in header textDenys Vlasenko2011-01-251-7/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: document a debugging scriptDenys Vlasenko2011-01-251-2/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: add keyboard commands to --helpDenys Vlasenko2011-01-131-0/+29
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* top: Use _exit() instead of exit() in sighandlerMarek Polacek2010-10-271-1/+2
| | | | | Signed-off-by: Marek Polacek <mmpolacek@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* pmap: new applet. +1k.Alexander Shishkin2010-08-281-8/+8
| | | | | | | | | | | | | | | | | | | pmap is a tool used to look at processes' memory maps, normally found in procps package. It provides more readable and easily sortable output (one line per mapping) from maps/smaps files in /proc/PID/. This would help in debugging memory usage issues, especially on devices where lots of typing is not a viable option. This patch does'n implement -d and -A command line options of GNU pmap, since those are not that must have features and I was afraid of going blind from looking at its code. The implementation takes smaps scanning part out of procps_scan() function and moves it into procps_read_smaps(), which does more detailed processing of a single PID's smaps data. Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: add tie breaking for topmem modeDenys Vlasenko2010-07-131-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: code shrink, -26 bytesDenys Vlasenko2010-06-061-33/+27
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: code shrinkMaksym Kryzhanovskyy2010-06-061-77/+42
| | | | | | | | | text data bss dec hex filename 853034 453 6820 860307 d2093 busybox_old 852726 453 6820 859999 d1f5f busybox_unstripped Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* consolidate ESC sequencesDenys Vlasenko2010-05-161-4/+4
| | | | | | | | | | | | | | function old new delta bell 2 - -2 CMdown 2 - -2 Ceos 4 - -4 Ceol 4 - -4 CMup 4 - -4 SOs 5 - -5 SOn 5 - -5 CMrc 9 - -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: make 's' display easier to understandDenys Vlasenko2010-03-041-6/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: suppress ~60% of "aliased warnings" on gcc-4.4.1Denys Vlasenko2010-02-041-3/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: do not use #if inside printf, it can be a macroDenys Vlasenko2009-11-071-18/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: introduce and use ffulsh_all()Denys Vlasenko2009-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2009-10-191-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ps: conditionally enable -T on non-DESKTOP build tooDenys Vlasenko2009-09-211-3/+3
| | | | | | | function old new delta ps_main 253 274 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>