4 ms·
Useful idea. I sometimes use time [1] to print stats at the end of the program's run, like so. /usr/bin/time -f 'user=%U system=%S maxrss=%M ins=%I outs=%O
by sigil 14y ago
Useful idea. I sometimes use time [1] to print stats at the end of the program's run, like so.
/usr/bin/time -f 'user=%U system=%S maxrss=%M ins=%I outs=%O" PROGRAM
Seeing stats while the program is running is nice though! Also, cumulative monitoring of an entire foreground process group would be super handy (a long build, for instance).
Drop the --target-output option, you don't need it. Same thing can be achieved with:
monner.py sh -c 'exec 1>/dev/null 2>&1 $0 "$@"' PROGRAM
I also agree with the other commenter that monner should be the parent process.
[1] Note, time(1) is not the same as the shell builtin of the same name.
- colinhowe 14y agoGood point! Changing it now :)
- nviennot 14y agoI personally prefer strace's options: -f -- follow forks, -ff -- with output into separate files -o file -- send trace output to FILE instead of stderr
- colinhowe 14y agoSwitched around the process architecture. Less code now :) Will look at dropping the target-output option.