[comp.unix.questions] Meaning of csh "time" output?

bin@rhesus.primate.wisc.edu (Brain in Neutral) (04/09/88)

The csh "time" command produces lines of the form:

	0.1u 0.4s 0:01 41% 18+17k 0+11io 21pf+8w

The csh manual explains the first 4 fields.  What do the rest
mean?

---
Paul DuBois     UUCP: {allegra,ihnp4,uunet}!uwvax!rhesus!dubois     |
                ARPA: dubois@rhesus.primate.wisc.edu              --+--
                                                                    |
alt.sex: just say rmgroup.                                          |

mouse@mcgill-vision.UUCP (der Mouse) (04/16/88)

In article <309@rhesus.primate.wisc.edu>, bin@rhesus.primate.wisc.edu (Brain in Neutral) writes:
> The csh "time" command produces lines of the form:
> 	0.1u 0.4s 0:01 41% 18+17k 0+11io 21pf+8w
> The csh manual explains the first 4 fields.  What do the rest mean?

From 4.2BSD csh source:

%Uu %Ss %E %P%% %X+%Dk %I+%Oio %Fpf+%Ww

%U	user time, seconds (ru_utime field of rusage struct)
%S	system time, seconds (ru_stime field of ditto)
%E	elapsed time, min:sec or hr:min:sec
%P	percentage of #:## accounted for by #.#u + #.#s
	 (ie, cpu utilization percentage)
%X	some sort of average (over time) of the text segment size
%D	ditto of the data+stack sizes
%I	"block input operations" (ru_inblock, see getrusage(2))
%O	"block output operations" (ru_oublock)
%F	page faults (from disk)
%W	swaps (entire process swapped)

%I and %O mean, according to the 4.3 man page for getrusage(), the
following:

ru_inblock	the number of times the file system had to perform
		input.

ru_outblock	the number of times the file system had to perform
     ^ [sic]	input.

Under NOTES, a warning appears:

The number ru_inblock and ru_outblock[sic] account only for real I/O;
data supplied by the caching mechanism is charged only to the first
process to read or write the data.

(grammar mistakes theirs).  And yes, <sys/resource.h> calls it
ru_oublock even though half the man page calls it ru_outblock.

					der Mouse

			uucp: mouse@mcgill-vision.uucp
			arpa: mouse@larry.mcrcim.mcgill.edu

jerryp@cmx.npac.syr.edu (Jerry Peek) (04/18/88)

In article <309@rhesus.primate.wisc.edu> bin@rhesus.primate.wisc.edu (Brain in Neutral) writes:
> 
> The csh "time" command produces lines of the form:
> 
> 	0.1u 0.4s 0:01 41% 18+17k 0+11io 21pf+8w

There's a way (undocumented on a lot of systems) to change this output to
any format you like.  I have a file called "settime" that makes a more readable
output.  Here's a demo (note that the output has different numbers, but that's
not the fault of the "settime" file):

	% date
	Mon Apr 18 10:48:56 EDT 1988
	% set time=0
	% date
	Mon Apr 18 10:49:06 EDT 1988
	0.0u 0.0s 0:00 50% 8+0k 1+0io 0pf+0w
	% source ~/.lib/settime
	% date
	Mon Apr 18 10:49:25 EDT 1988
	  user=0.0 sec, system=0.0 sec, elapsed=0:00 min, cpu use=9%, 0 swaps,
	  2 disk reads, 1 disk writes.  Data+stack+text pages: 24 avg., 3 max.

Here's what's in the "settime" file.  Sorry, but I couldn't see putting it
into a shell archive.

--Jerry Peek, Northeast Parallel Architectures Center, Syracuse, NY
  jerryp@amax.npac.syr.edu
  (315)423-1722

-----------  cut here and save in file named "settime" -----------
# file that sets C-shell "time" variable in my own format.
# shows time of all processes and built-in commands.
# Usage: 	% source ~/.lib/settime
set time = (0 "  user=%U sec, system=%S sec, elapsed=%E min, cpu use=%P, %W swaps,\
  %I disk reads, %O disk writes.  Data+stack+text pages: %K avg., %M max.")