6

Zsh has an ingenious feature that automatically prints timing statistics for commands taking longer than $REPORTTIME to execute. Think of it as automatically executing a pipeline through time as needed.

From the Zsh Manual:

REPORTTIME
    If nonzero, commands whose combined user and system execution times
    (measured in seconds) are greater than this value have timing statistics
    printed for them.

Does there exist a similar feature, or set of scripts that enables similar behaviour, for Bash?

earl
  • 212
  • 1
  • 5
  • 2
    One clever hack is mentioned in [this thread](http://superuser.com/questions/117227/a-command-before-every-bash-command). Another way is to use [something like zsh's `preexec`](http://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-executing-a-command). – Gilles 'SO- stop being evil' Aug 14 '10 at 11:25

1 Answers1

5

I have an implementation of it, here: https://github.com/mstormo/reporttime

Clone the Git repo, and simply source the reporttime.bash script. Also allows you to put the timing components into your Bash prompt directly, instead of having it reported on a separate line.

mstormo
  • 66
  • 1
  • 2