system call performance 4.x vs 5.x [and UP vs MP]

Robert Watson rwatson at freebsd.org
Wed Jan 28 12:59:18 PST 2004


On Wed, 28 Jan 2004, Robert Watson wrote:

>         printf("%d.%09lu for %d iterations\n", ts_end.tv_sec,
>             ts_end.tv_nsec, NUM);
>         printf("%d.%09lu per/iteration\n", ts_end.tv_sec / NUM,
>             ts_end.tv_nsec / NUM);

Having posted this, I should point out that this suffers an error if you
get above a second total measurement time (which I generally don't do to
avoid being preempted).  Something like the following would work slightly
better: 

	ts_end.tv_sec *= 1000000000 / count;
	printf("0.%09lu per/iteration\n", ts_end.tv_sec +
	    ts_end.tv_nsec / count);

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research




More information about the freebsd-current mailing list