measure execution time

Oftentimes we want to know how long a command takes to execute on the command line, may it be for comparing runtime behaviour to a previous version, or to see how a system reacts.

The command that does this is time

Thomass-MacBook-Pro:build thomas$ time git diff
..
real	0m2.999s
user	0m0.757s
sys	0m2.030s
Thomass-MacBook-Pro:build thomas$
  • real – the absolute time it took
  • user – the time the CPU spent in your process
  • sys – the time the CPU spent in the kernel of the operating system