Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Home

Heiner

runtimes - run a command several times, print statistics

The runtimes command works similar to the standard Unix time(1) command, and prints the run time (real, user, sys) for a comand. In addition runtimes can run a program several times instead of once. Example:

$ runtimes -n3 -v sleep 1
3 runs           real       user        sys
#1           1.001102   0.000000   0.000000
#2           1.001155   0.000000   0.000000
#3           1.001154   0.000000   0.000000
totals       3.003411   0.000000   0.000000

average      1.001137   0.000000   0.000000
variance     0.000000   0.000000   0.000000
stddev       0.000030   0.000000   0.000000

The variance and standard deviation values allow finding time-variant behaviour like caching effects. Example:

$ runtimes -n3 find /usr
3 runs              real       user        sys
totals         59.662466   0.680042   3.092193

average        19.887489   0.226681   1.030731
variance     1101.982493   0.003750   0.826029
stddev         33.196122   0.061235   0.908861

The large values for variance and stddev show that the find command does not always run in the same time, but has large differences in the run time. In this case (although we do not see it from the data) the first run was slow, the following two runs were fast because of the operating system caching the file information.