[net.bugs.4bsd] prof at 60 Hz, profil at 100 Hz

essick@uiucdcsb.UUCP (12/10/84)

Several people have pointed out the fact that the SUN machines use
50 Hz and thus my changes don't work quite so well on them. One
could just change the #define, but a more "elegant" method is
to open /dev/kmem and burrow through the namelist to find how
fast the timer really ticks on that machine.

I'll spare you the details of figuring out how to do this.  When I
get that far (if ever), I'll just steal the appropriate code from
"gprof" which figures the clock rate in just this manner.

-- Ray Essick, University of Illinois
-- {ihnp4,convex,pur-ee}!uiucdcs!essick   essick%uiuc@csnet-relay.arpa

essick@uiucdcsb.UUCP (12/19/84)

Description:
	/usr/bin/prof still lives in the days of 60 Hz. Meanwhile,
profil(2) generates data at 100 Hz.  Thus prof reports numbers
that are about 1.6 times as large as they should be.

Repeat-By:
	pick some program, compile it with profiling, and execute:

	time testit
	prof testit

Look at the difference between the numbers reported by "time" and
by "prof".

Fix:

2a3
> static char rcsid[] ="$Header: prof.c,v 4.3.1.2 84/12/05 23:32:37 root Exp $";
12a14
> #define	HERTZ		100		/* RBE -- 4.2 uses 100 not 60 */
171c173
< 		printf("%6.1f%9.2f", 100*time, actime/60);
---
> 		printf("%6.1f%9.2f", 100*time, actime/HERTZ);
174c176
< 			    np->ncall, np->time/(np->ncall*.06));
---
> 			    np->ncall, ((float) np->time*1000)/(np->ncall*HERTZ));


-- Ray Essick, University of Illinois
-- {ihnp4,pur-ee,convex}!uiucdcs!essick    essick%uiuc@csnet-relay