aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/ps.c
AgeCommit message (Collapse)Author
2019-05-16Have ps.c human_readable fields use all the available space.Rob Landley
2019-05-16Use the space reserved in the header to display more precision.Rob Landley
2019-05-16Minor code shrink.Rob Landley
2019-03-02Make top -H show TID instead of PID, not collate %CPU into parent threadRob Landley
(resulting in 400% CPU with 4 threads), and add a couple comments.
2019-03-01Yes it's a one instruction race, but it bothers me.Rob Landley
2019-02-27top: fix -b.Elliott Hughes
We hadn't updated the output in -b mode ever since I broke this in 2016. Bug: http://b/126347053 "top doesn't seem to update the output when run in batch mode (-b)"
2019-02-17top: make the task/thread count add up.Elliott Hughes
Linux has more states than we were giving it credit for, which led to our numbers not adding up. Since the exact details seem to change between versions, and since having code specific to each kernel version is unattractive, go with the heuristic that there are relatively fewer "stopped" states (and they change less frequently), so all unknowns are "sleeping".
2019-02-16Disallow -o "" in top.Rob Landley
2019-02-16top: differentiate tasks (processes) and threads in the header.Elliott Hughes
2019-02-16top: make the column header span the terminal.Elliott Hughes
This also makes everything more readable by separating out the -b no formatting case. The whitespace trimming for -b isn't strictly necessary, but it looks weird if we output unnecessary spaces at the end of the line in -b mode, and we've fixed it before, so let's not regress here. It also seems more logical to do this in the one place where it actually happens.
2019-02-13top: support Enter as a synonym for Space.Elliott Hughes
Both refresh the display in the traditional implementation.
2019-02-13top: use human_readable for the header lines too.Elliott Hughes
Even phones have enough RAM these days that KiB is not a reasonable unit. Traditional top always uses MiB instead of always using KiB, but we may as well just let human_readable pick a unit (that way if KiB is reasonable on your box, that's what you'll get). Before: Tasks: 967 total, 1 running, 581 sleeping, 0 stopped, 0 zombie Mem: 196734820k total,183891564k used, 12843256k free, 5805008k buffers Swap:199888892k total, 719104k used,199169788k free,130367280k cached After: Tasks: 965 total, 2 running, 577 sleeping, 0 stopped, 0 zombie Mem: 188G total, 175G used, 13G free, 5.5G buffers Swap: 191G total, 702M used, 190G free, 124G cached
2019-02-13top: hide the cursor in interactive mode.Elliott Hughes
Matches traditional top.
2019-02-07ps, top: fix VIRT and SHR fields.Elliott Hughes
2019-01-25OpenEmbedded needs commands installed in specific places.Rob Landley
2019-01-21Add more comments to ps.c and replace hardcoded value with a macro.Rob Landley
If table grows >64 entries XX needs to change, but it can't be 128 yet because the slot value is a signed char. Currently 59 entries in table...
2018-12-29Use FLAG() macros in ps.Rob Landley
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-11-30Tweak comments.Rob Landley
2018-11-30macOS: move struct sysinfo out of GLOBALS.Elliott Hughes
Even if we don't build ps, we can't have a Linux-only struct in GLOBALS. The obvious alternative to this would be to have a fake struct sysinfo in lib/portability.h. Since having a real macOS replacement for sysinfo(2) seems unlikely at this point, I went this route instead.
2018-10-21Add % to lib/args.c (long time in milliseconds), add xmillitime(), redoRob Landley
xparsetime() not to need floating point, adjust callers.
2018-10-21Move start_redraw() to lib/ and have ps.c (top) use it.Rob Landley
2018-08-25Convert more argument variables in GLOBALS() to new style.Rob Landley
2018-08-17Make microcom use set_terminal() and move speed setting into set_terminal().Rob Landley
2018-07-18ps.c cleanups after help text reshuffle.Rob Landley
2018-07-18Factor out "ps -o help" to show fields, move help text into -o type array,Rob Landley
add comments to get_ps().
2018-06-12top: remove flicker in interactive mode.Elliott Hughes
2018-06-12top: running processes are shown in bold.Elliott Hughes
2018-06-02Convert more ps help text to two columns.Rob Landley
2018-05-06Support fractional seconds (and other time units) in `top -d`.Elliott Hughes
LTP uses `top -d 0.1`, which isn't convincingly useful, but general support for other time units might be useful, and switching to xparsetime addresses both at once. Also fix 3169d948c049664bcf7216d4c4ae751881099d3e where I mistakenly treated `rev` and `toys.optflags&FLAG_b` as interchangeable. (Without this second fix, `top -b` looks fine but `top` is broken!) Also fix xparsetime to reject input such as "monkey" or "1monkey".
2018-04-23Don't include spurious '\r's in `top -b` output.Elliott Hughes
2018-02-10Fix ps -T again, but this time read files from tid directory, not pid.Rob Landley
(Otherwise updating pid to parents makes threads read thread parent data.)
2018-02-10Rename struct strawberry -> struct ofields, and carveup -> procpid.Rob Landley
The first contains display fields selectable by the -o argument, the second contains the /proc/$PID data for one process.
2018-02-09Andreas Gampe suggested a different fix.Rob Landley
(Bionic _does_ do the malloc(0)!=0 thing, the problem is pedantic access checking, not null dereference. So test count instead.)
2018-02-08Thinko pointed out by Andreas Gampe (causing segfaults in top, oops).Rob Landley
2018-01-24Revert the ps -T thing until I understand what Elliott wants.Rob Landley
2018-01-15Fix "ps -T 1234" to show thread belonging to that PID.Rob Landley
2018-01-15Merge shared_main() back into ps_main() and top_main(), add comments.Rob Landley
2018-01-15Add more comments to ps.Rob Landley
2018-01-06Move millitime() into lib.c.Rob Landley
2017-10-31Add top -m, fix width truncating for narrow screens (off by one), and add ↵Rob Landley
iotop -H
2017-08-31Another try at fixing the ps segfault resulting from /proc entries vanishingRob Landley
out from under us due to asyncronous process exit. The directory we're traversing vanishing can result in DIRTREE_ABORTVAL being returned, which we turn into a NUL entry, but then we were trying to look at that null entry's children. Oops.
2017-06-19Manually inline TOP_COMMON and PGKILL_COMMON help text until I can teachRob Landley
the help infrastructure to handle it. (The lifetime rules are all wrong for hunks that get reused. Needs a largeish rewrite.)
2017-03-28ps: don't query for terminal size if not a tty.Josh Gao
`ps -A | cat` shouldn't have different output depending on the size of your terminal window.
2017-03-21dirtree_flagread() returns DIRTREE_ABORTVAL when the initial node doesn'tRob Landley
exist, which can hit ps when /proc isn't there or /proc/$PID/task isn't there (because process exited between the time we checked its contents and the time we looked for its threads).
2017-02-20If the last ps field is left justified, it extends to the width of the screen.Rob Landley
(Recent "show + for last char when truncated" change broke that, putting it back.)
2017-02-06ps -l has 4 chars left for "cmd", switch "ADDR" to "BIT" to save space.Rob Landley
2017-02-06Make tty size failure to enable -w (Elliott prefers that), and fix last fieldRob Landley
to be left justified again.
2017-02-05Don't set SIGWINCH when reading ANSI size probe data, it causes a loop.Rob Landley
2017-02-05Bugfix: last field was padding to width with trailing spaces (oops), andRob Landley
when we can't query terminal size pad to 80 but add -w.