18 December 2021

When I need to know execution and system execution time elapsed for a script there is a command that I use time

Note: all example below could be execute in a container:

docker run -it  ubuntu /bin/bash

Example:

time sleep 2

The output is:

real	0m2.002s
user	0m0.000s
sys	0m0.002s

Where:

User+Sys will tell you how much actual CPU time your process used. Note that this is across all CPUs, so if the process has multiple threads, it could potentially exceed the wall clock time reported by Real.

References