The simplest way to gather basic data about program performance and resource utilization is to use the time (1) command or, in csh, the set time command.
Running the program with the time command prints a line of timing information on program termination.
demo% time myprog The Answer is: 543.01 6.5u 17.1s 1:16 31% 11+21k 354+210io 135pf+0w demo% |
The interpretation is:
user system wallclock resources memory I/O paging
6.5u 17.1s 1:16 31% 11+21k 354+210io 135pf+0w 6.5 seconds in user code, approximately |
system– 17.1 seconds in system code for this task, approximately
wallclock– 1 minute 16 seconds to complete
resources– 31% of system resources dedicated to this program
memory– 11 Kilobytes of shared program memory, 21 kilobytes of private data memory
I/O– 354 reads, 210 writes
paging– 135 page faults, 0 swapouts
Timing results are interpreted in a different way when the program is run in parallel in a multiprocessor environment. Since /bin/time accumulates the user time on different threads, only wall clock time is used.
Since the user time displayed includes the time spent on all the processors, it can be quite large and is not a good measure of performance. A better measure is the real time, which is the wall clock time. This also means that to get an accurate timing of a parallelized program you must run it on a quiet system dedicated to just your program.