REPORTTIME in zsh
REPORTTIME
is a nifty feature of zsh
. If you set it to a non-negative value, then every time, any command you run that takes longer than the value you set it to in seconds, zsh
will print usage statistics afterwards as if you had run the command prefixed with time
.
So, for example, if we run rake
to rebuild any out of date files in Rubinius, we get this:
~/Development/Rubinius ☺ » rake
[ … Lots of output …]
Finished in 136.926808 seconds
3866 files, 21497 examples, 59187 expectations, 0 failures, 0 errors
rake 160.78s user 26.49s system 81% cpu 3:50.20 total
(Yes, my prompt has a smiley in it. It turns sad and red when the exit status is non-zero)
How to enable this
Since this only makes sense in interative shells, I set this value in my .zshrc
:
# Report CPU usage for commands running longer than 10 seconds
REPORTTIME=10