/usr/bin/time notes

/usr/bin/time is a useful command (not to confuse with “time”) that can measure “real,user,sys”, but also “maximum resident set size, page faults, swaps” and other very useful system info for a specific program.

In GNU stack based unix, just do /usr/bin/time

In BSD based stack (mac), you need /usr/bin/time -lp 

“time” command is a shell script in bash, not the same as the builtin linux function

http://stackoverflow.com/questions/19236448/shell-execution-time-vs-usr-bin-time

http://man7.org/linux/man-pages/man1/time.1.html

I believe the /usr/bin/time actually calls the system function “getrusage” http://linux.die.net/man/2/getrusage

which can give the resources statistics as shown in /usr/bin/time

A sample output is shown here

real         0.00

user         0.00

sys          0.00

688128  maximum resident set size

0  average shared memory size

0  average unshared data size

0  average unshared stack size

180  page reclaims

0  page faults

0  swaps

0  block input operations

0  block output operations

0  messages sent

0  messages received

0  signals received

0  voluntary context switches

1  involuntary context switches

 

Another example output

99.21user 49.40system 2:06.92elapsed 117%CPU (0avgtext+0avgdata 3556152maxresident)k

This shows that it spent 99s in user program, 50s in system kernels, total elapsed time is 2 min and 6 s. There is an average of 117% CPU utilization. This shows it is mostly single threaded.

This entry was posted in Tools, Uncategorized and tagged . Bookmark the permalink.

Leave a comment