w00d
w00d

Reputation: 5596

Measure Computing Time and I/O Time of a Program

Is there any program to measure the total computing time and total I/O time (writing to stdout or file) of a given program?

Edit: It's Linux 64-bit program

Upvotes: 1

Views: 1380

Answers (2)

bobah
bobah

Reputation: 18864

time:

$ time echo "hello world"
hello world

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

strace -c:

$ strace -c echo "hello world"
hello world
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
   nan    0.000000           0         1           read
   nan    0.000000           0         1           write
   nan    0.000000           0        14        12 open
   nan    0.000000           0         3           close
   nan    0.000000           0        12         9 stat
   nan    0.000000           0         3           fstat
   nan    0.000000           0         8           mmap
   nan    0.000000           0         3           mprotect
   nan    0.000000           0         2           munmap
   nan    0.000000           0         3           brk
   nan    0.000000           0         1         1 access
   nan    0.000000           0         1           execve
   nan    0.000000           0         1           uname
   nan    0.000000           0         1           arch_prctl
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                    54        22 total

Upvotes: 1

You could use the time command to get the total wall clock and total CPU time that a process takes. This will get you a reasonable estimate, especially for I/O heavy processes.

Upvotes: 0

Related Questions