Measure running time of a command |
|
Friday, 14 October 2011 |
If we want to know how much time runs an app from command line (for example compiling a kernel) we can use the following script:
time_measure #!/bin/sh
t_start=$ (/bin/ date +%s )
$*
t_stop=$ ( /bin/ date +%s )
time=$ (/bin/expr $ {t_stop } - $ {t_start })
echo "Command completed in: ${time} seconds."To measure time for the kernel to be compiled we will run:
cd /usr/src time_measure make buildkernel kernconf=GENERIC
Don't forget to copy time_measure script in /usr/local/bin and to make it executable.
|
Last Updated ( Friday, 14 October 2011 )
|