[comp.unix.wizards] Sun Unix `time' command

souza@telesoft.UUCP (Steve Souza @eldest) (01/23/88)

In some timing tests recently done on Sun3s running 3.2 and 3.4 we've 
found large discrepancies in the "average shared memory" and "unshared 
data space" statistics reported by the C-shell `time' command.  

In summary, it appears that the memory usage reported by the 3.4 version 
of `time' is much larger that the amount reported by the 3.2 version for 
execution of the same program under similar conditions.  The difference
has been anywhere from 2 to 10 times greater for version 3.4.
Here are the results of some typical Unix commands:
-------------------------------------------------------------------------
"ps aux"

3.2:	0.7u 4.1s 0:06 76% 6+9k 20+1io 0pf+0w
3.4:	0.9u 1.6s 0:04 58% 48+72k 35+3io 0pf+0w

"nroff -man /usr/man/man1/csh.1"

3.2:	67.2u 0.9s 1:16 88% 2+9k 40+46io 0pf+0w
3.4:	69.0u 3.0s 1:45 68% 16+72k 41+47io 0pf+0w

"cc -O test.c"

3.2:	0.8u 1.5s 0:06 36% 4+4k 130+38io 26pf+0w
3.4:	0.9u 1.1s 0:06 31% 32+32k 107+43io 5pf+0w
-------------------------------------------------------------------------
The machines involved were both Sun3 160s with 16MB of memory.

Why these numbers differ so drastically?  The only clue we found was a note 
about a bug fix in 3.4 for the memory device driver ("Release 3.4 Manual for 
the Sun Workstation", p111).  Assuming the method of stat calculation in
csh has remained the same between releases, do any of you "in-the-know"
kernel hackers out there know of any changes?

Other ideas?

Please e-mail with any information.  I'll repost if the problem is of
general interest (i.e., not embarassingly obvious :-).

Many thanks,

Steve Souza			sdcsvax!telesoft!souza, telesoft!souza@sdcsvax
TELESOFT Inc., San Diego, CA	(619)457-2700 x277

guy@gorodish.UUCP (01/24/88)

> In summary, it appears that the memory usage reported by the 3.4 version 
> of `time' is much larger that the amount reported by the 3.2 version for 
> execution of the same program under similar conditions.

...

> 3.2:	0.7u 4.1s 0:06 76% 6+9k 20+1io 0pf+0w
> 3.4:	0.9u 1.6s 0:04 58% 48+72k 35+3io 0pf+0w

> Assuming the method of stat calculation in csh has remained the same between
> releases,

I suspect you'll get many, many mail messages containing completely incorrect
explanations (this *is* USENET, after all), so here's the official scoop:

The method of stat calculation *didn't* remain the same between releases.  From
the SCCS log of "/usr/src/bin/csh/sh.time.c", for a delta applied after the 3.2
release:

	...Also fixed bug in amounts printed when time is set -- now takes
	system page size into account.

You'll note that the numbers in 3.4 are 8 times bigger than the numbers
in 3.2.  Note also that the (software) page size on a VAX is 1KB, while the
page size on a Sun-3 is 8KB.  The 3.2 "csh" used the straight 4.3BSD code,
which "knew" that "pages" and "Kbytes" were the same thing; the 3.4 "csh" had
this bug fixed.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com