· tools forensics

WTF time? Give me options!

I’m looking at the computational cost of computing various hashes. Naturally, I want to collect run time statistics on each hash command and collect this metric several thousand times.

The natural choice is to go with time, but I need to use time’s format option to output a CSV output. Sounds easy:

[email protected]:~$ time -f %e,%S,%U md5sum .viminfo
bash: -f: command not found

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

WTF? -f is an option, not a command! Come to find out, Bash has its own built-in time command which doesn’t have the same options as the GNU time command! So you’ll need to use the full path to the GNU utility. If you don’t know it, use which:

[email protected]:~$ which time

Now, let’s try this again:

[email protected]:~$ /usr/bin/time -f %e,%S,%U md5sum .viminfo
0cc07f508925f94b18f50166576b83c7  .viminfo


You can also use -a -o filename to specify where to put that csv output across multiple runs.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket