SUMMARY - interpretation of time command

From: Dan A. Zambon (dzambon@afit.af.mil)
Date: Wed Mar 02 1994 - 13:39:39 CST


Hi Netters!
A few weeks ago I set out the post below asking about the interpretation
of the "time" command. A user had generated some results from a sript
file, and wanted to know what was being displayed.

As always, this net came through with much useful information. I will
attempt to put it now into a summary.....

*******************************************************************
The original post was:
*******************************************************************
Hi Netters!!

I am posting this for a friend. I would appreciate any information
that you can provide for him. The question concerns the meaning of
the results of the "time" command (SunOS 4.1.3 on a Sparc 2)

Thanks for your time and effort.

Dan
------------------------------------------------------------------
Dan A. Zambon email: dzambon@afit.af.mil
Air Force Institute of Technology phone: (513) 255-6565, ext
Department of Electrical and Computer Engineering 4280
Wright Patterson AFB, Oh 45433-7765
------------------------------------------------------------------
  

*****************************************************************
I timed several executions of a program with larger input for each
successive execution. This is what I had in the script file.

--------------------------------------------
#! /bin/csh -f

time graph < 4queen_adj >& 4queen_adj.out
time graph < 5queen_adj >& 5queen_adj.out
time graph < 6queen_adj >& 6queen_adj.out
time graph < 7queen_adj >& 7queen_adj.out
time graph < 8queen_adj >& 8queen_adj.out
time graph < 9queen_adj >& 9queen_adj.out
time graph < 10queen_adj >& 10queen_adj.out
time graph < 11queen_adj >& 11queen_adj.out
time graph < 12queen_adj >& 12queen_adj.out
------------------------------------------

This is what I got for timings:

2.4u 0.1s 0:02 98% 0+572k 0+3io 0pf+0w
4.5u 0.2s 0:04 99% 0+616k 0+7io 0pf+0w
10.4u 0.6s 0:11 98% 0+704k 0+13io 0pf+0w
36.2u 1.7s 0:38 99% 0+812k 0+27io 0pf+0w
204.7u 7.4s 3:34 99% 0+888k 0+74io 0pf+0w
1577.4u 46.2s 27:43 97% 0+916k 0+317io 0pf+0w
14201.1u 319.9s 4:03:08 99% 0+948k 3+2022io 3pf+0w

I have a general understanding of what the numbers mean,
but could tell me specifically, and quantifiably, what each
number means?
*********************************************************************
end of original post
*********************************************************************

The respondees suggested ideas such as:
-use the man page on csh (quite a few of these). This I needed because
 I was looking for help concerning time, not csh. My poor understanding
 of Unix got me again.
-use /usr/bin/time or /usr/5bin/time instead of csh builtin time
-some users pointed out that /bin/time was desirable for them (as
 compared to the one used in csh) because of it being easier to
 understand
-and some responses were very precise, taking the output and explaining each
 item, such as:
 
> 2.4u 0.1s 0:02 98% 0+572k 0+3io 0pf+0w
 
Field 1: User time. How much time the process spent on behalf of the user.
Field 2: System time. How much time in system calls.
Field 3: Total elapsed time (real time) process used(rounded down).
Field 4: CPU time as a percentage of real time.
Field 5: Shared memory used + nonshared memory used.
Filed 6: # of blocks input + # blocks output.
Field 7: # page faults + # swaps.

-and a winning entry from Chad Netzer (I do appreciate it), in which
 he explains my questions so even my puppy would understand...and she
 doesn't like unix either.....:>)

2.4u 0.1s 0:02 98% 0+572k 0+3io 0pf+0w

    2.4u is the number of seconds of CPU time devoted to the user's
process. This indicates the number of seconds that the CPU actually
spent in executing user program code.
 
    0.1s is the number of seconds spent executing system functions (in
the kernel) that were called by your program.
 
    0:02 is the number of minutes and seconds of real time that it
took the program to execute. Note that this number must be equal or
greater than the previous two values added together, ignoring round
off. On a busy system, this number can be much higher since your
program will probably be interrupted by other processes. It is the
amount of time you would measure on a stopwatch between when you
started running the program and when it finished.
 
    98% is defined as the total CPU time, both user plus system, as a
percentage of the elapsed time. In other words, it is the sum of the
first two values, divided by the third value, and expressed as a
percent. The closer that it gets to 100%, the less the program was
interrupted by other user or system processes.
 
    0+572k means that the program used 0 kilobytes of shared memory,
and 572 kilobytes of unshared memory.
 
    0+3io means the program did 0 block input operations, and 3 block
output operations. This may not correspond directly to the number I/O
calls in the program, because the I/O library uses buffering, etc, and
may make only a few block I/O calls per thousands of character I/O
calls.

    0pf+0w means 0 page faults and 0 swaps. This is just basic info
on the virtual memory usage.
 
 
    The important thing to know is that 2.4 user seconds means
acumulated time spent executing the user code for this specific
process, and can be used directly used in performance calculations.
Ie. if the code loops a thousand times, then it took roughly 0.0024
seconds per loop. The 0.1 seconds of system time means that, for this
example, the program spent only a small proportion of its time
executing system (kernel) calls. The two number added together give
the total CPU time usage for this program.

*****************************************************************
Special thanks go to:
Gautam Das <gautam@bwc.org>
don@mars.dgrc.doc.ca (Donald McLachlan
Todd Kover <kovert@cs.UMD.EDU>
feldt@phyast.nhn.uoknor.edu (Andy Feldt)
cciolori@tatca.tc.faa.gov (Chris Ciolorito)
eddy@telecomm.tadiran.co.il Edward Resnick
Mike Raffety <mike_raffety@il.us.swissbank.com>
markus@octavia.anu.edu.au (Markus Buchhorn)
Chad Netzer <chad@vision.arc.nasa.gov>
and anyone I might have missed.....:>)

The friend got the information that he needed, and I convey to you both
his and my thanks for your time and efforts. Such a great resource this
is!

Dan Zambon
------------------------------------------------------------------
Dan A. Zambon email: dzambon@afit.af.mil
Air Force Institute of Technology phone: (513) 255-6565, ext
Department of Electrical and Computer Engineering 4280
Wright Patterson AFB, Oh 45433-7765
------------------------------------------------------------------

  

 



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:56 CDT