You are not logged in.

#1 2014-10-18 22:44:38

Osiris
Member
Registered: 2003-01-18
Posts: 160
Website

Better time utility

Hello,

the builtin time can be used to time process execution times. Is there some enhanced version of time? I could use features like, start the process 10 times and give statistics about execution times.

Thx!

Offline

#2 2014-10-19 01:00:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Better time utility

Why not use a 'for' loop for this?
If you want mean and standard deviations statistics, you'd have to use some other tool to compute them.

Offline

#3 2014-10-19 01:01:22

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Better time utility

Not a GNU/Linux discussion, moving to Apps & DEs...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2014-10-19 06:22:16

cargoan
Member
Registered: 2013-07-13
Posts: 20

Re: Better time utility

GNU time (pacman -S time).
After install call with /usr/bin/time or create an alias in your .bashrc file (alias time="/usr/bin/time")

Offline

#5 2014-10-19 08:59:43

Osiris
Member
Registered: 2003-01-18
Posts: 160
Website

Re: Better time utility

Regarding its man page http://man7.org/linux/man-pages/man1/time.1.html it does not seem to have a lot more features than builtin time, esp. no statistics over multiple run. Or have it?

Offline

#6 2014-10-19 12:28:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Better time utility

They have different output formatting options, one may be easier parseable than the other, time(1) can show much more info, but it may be irrelevant in your situation.

Offline

#7 2014-10-19 17:24:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Better time utility

lrzip provides its own nice and verbose output, but I cobbled this:

$ for i in 1 4 6 9; do /usr/bin/time -f'%E : %C' -ao foo lrzip -fqg -L$i test.tar -o $i.lrz; done; du -sh *.lrz | sort -k 2 > bar

Summary:

$ join -o 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.1 -1 8 -2 2 foo bar
0:00.07 : lrzip -fqg -L1 test.tar -o 1.lrz 292K
0:00.10 : lrzip -fqg -L4 test.tar -o 4.lrz 268K
0:00.17 : lrzip -fqg -L6 test.tar -o 6.lrz 256K
0:00.57 : lrzip -fqg -L9 test.tar -o 9.lrz 252K

Short version:

$ join -o 1.1 1.5 2.1 -1 8 -2 2 foo bar
0:00.07 -L1 292K
0:00.10 -L4 268K
0:00.17 -L6 256K
0:00.57 -L9 252K

You can add headers, like 'time', 'compression level' and 'filesize' to make it prettier.



As for some statistic:

$ for i in 1 4 6 9; do /usr/bin/time -f'%e' -ao baz lrzip -fqg -L$i test.tar -o $i.lrz; done
$ cat baz
0.07
0.10
0.17
0.55
$ datastat --dev --min --max baz | tr '#' ' ' | column -t
avg     dev       min   max
0.2225  0.192532  0.07  0.55

See e.g. http://stackoverflow.com/questions/9789 … s-in-linux

Offline

Board footer

Powered by FluxBB