[comp.unix.questions] question re time

leff@smu (04/25/88)

I am confused about the output of time under csh.

According to the man page, I get three numbers
  the elapsed time during the command, the time spent in the system,
    and the time spent in execution of the command

What are the other four numbers output that are apparently undocumented?

What exactly do "elapsed time," "time spent in the system"
and "time spent in the execution of the command" mean???

One of our faculty has been attempting to interpret the output of
this command when applied to running ingres and we are not clear
what these things mean.  She needs this for reporting some benchmarks
run under Ingres.

jerryp@cmx.npac.syr.edu (Jerry Peek) (06/05/88)

In article <250300003@smu> leff@smu writes:
> I am confused about the output of time under csh.

[I apologize to the net if you've already got one of my other postings
of this man page, or if this seems to be the wrong newsgroup.]

I've answered this question about five times in the last year.
But that's because a lot of OS's documentation doesn't explain csh "time"
output.  Here's a man page that I got from USENET a couple of years ago.
I think it'll help.  It also shows the undocumented way to customize
the csh "time" output.  (To read it, run "nroff -man csh_time.7" on it.)

--Jerry Peek, Northeast Parallel Architectures Center, Syracuse, NY 13244-1260
  jerryp@cmx.npac.syr.edu
  +1 315 423-4120

-------- SHELL ARCHIVE -- CUT HERE FOR csh_time.7 -------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	/tmp/csh_time.7
# This archive created: Sun Jun  5 09:01:52 1988
export PATH; PATH=/bin:$PATH
if test -f 'csh_time.7'
then
	echo shar: will not over-write existing file "'csh_time.7'"
else
sed 's/^X//' << \SHAR_EOF > 'csh_time.7'
X.TH TIME 7
X.UC 4
X.SH NAME
Xtime \- time a command
X.SH SYNOPSIS
X.B time
Xcommand
X.SH DESCRIPTION
XThe
Xgiven command is executed; after it is complete,
X.I time
Xprints the elapsed time during the command, the time
Xspent in the system, and the time spent in execution
Xof the command.
XTimes are reported in seconds.
X.PP
XOn a PDP-11, the execution time can depend on what kind of memory
Xthe program happens to land in;
Xthe user time in MOS is often half what it is in core.
X.PP
XThe times are printed on the diagnostic output stream.
X.PP
X.I Time
Xis built in to
X.I csh(1),
Xusing a different output format.
X.SH LOCAL\ CSH
X.PP
XThe output format is selectable by the user
X(this feature is undocumented by UCB, and so may not be supported later).
XIf the
X.I time
Xshell variable has two components
Xthen the second component is taken to be an output specification string
Xreminiscent of
X.IR printf (III).
X.de mI
X.ti -4
X\\$1\ \ 
X..
XA percent sign introduces a conversion operator;
Xthe next character specifies the desired conversion.
XOther characters are simply printed.
XThe conversion characters and their meanings are:
X.sp
X.in +6
X.mI U
XUser time in seconds.
X.mI S
XSystem time in seconds.
X.mI E
XElapsed time in seconds.
X.mI P
XPercentage of the CPU.
X.mI X
XAverage kilobytes of resident text pages.
X.mI D
XAverage kilobytes of resident data+stack pages.
X.mI K
XAverage kilobytes of resident text+data+stack pages.
X.mI M
XMaximum kilobytes of resident text+data+stack pages.
X.mI I
XThe number of filesystem input events
X(reads that came from the disk).
X.mI O
XThe number of filesystem output events
X(writes that went to the disk).
X.mI F
XThe number of page faults which resulted in disk activity.
X.mI R
XThe number of page faults resulting from the simulation of reference bits.
X.mI W
XThe number of swaps which occurred.
X.in -6
X.ne 7
X.PP
XThe default format is
X.ti +2
X.nf
X"%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww".
X.fi
XYou might want to try
X.ti +2
X.nf
X"%Uu %s %E %P (%Xt+%Dds+%Kavg+%Mmax)k %Ii+%Oo (%Fmaj+%Rmin)pf %Wswaps"
X.fi
Xif you want more information and more mnemonic identifiers.
X.PP
XNote that if the format string has any special characters
X(including spaces) then they must be protected by quoting.
X.SH BUGS
XElapsed time is accurate to the second,
Xwhile the CPU times are measured
Xto the 60th second.
XThus the sum of the CPU times can be up to a second larger
Xthan the elapsed time.
X.PP
X.I Time
Xis a built-in command to
X.IR csh (1),
Xwith a much different syntax.  This command is available as
X``/bin/time'' to
X.I csh
Xusers.
X.SH EXAMPLE
X.nf
Xset x="%Uu %Ss %E %P (%Xt+%Dds+%Kavg+%Mmax)k %Ii+%Oo (%Fmaj+%Rmin)pf %Wswaps"
Xset time=(60 "$x")
X.fi
X.SH SEE\ ALSO
X.IR vtimes (2V)
X.SH MANUAL-PAGE HISTORY
XWritten by Mark Wittenberg ({zehntel,varian}!rtech!mark).
XWritten for 4.1bsd csh; I don't know if it much has changed
Xfor 4.2bsd.  Copied via USENET from David Brown, (415) 945-2199,
XVarian Instruments, 2700 Mitchell Dr.,  Walnut Creek, CA 94598,
X{zehntel,amd,fortune,resonex}!varian!david
SHAR_EOF
if test 2962 -ne "`wc -c < 'csh_time.7'`"
then
	echo shar: error transmitting "'csh_time.7'" '(should have been 2962 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0