Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2002 14:42:56 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        current@FreeBSD.ORG
Subject:   Re: how to compute the skew between TSC in SMP systems ?
Message-ID:  <20020823144256.A82380@iguana.icir.org>
In-Reply-To: <30323.1030137730@critter.freebsd.dk>; from phk@critter.freebsd.dk on Fri, Aug 23, 2002 at 11:22:10PM %2B0200
References:  <20020823141314.A82172@iguana.icir.org> <30323.1030137730@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 23, 2002 at 11:22:10PM +0200, Poul-Henning Kamp wrote:
...
> >> >does anyone have an idea on how to determine the skew between
> >> >TSC content in the various processors on an SMP box ?
> >> 
> >> On i386: It cannot be reliably done.  Been there, tried that.
> >
> >the problem being what, too much jitter e.g. in measurement method
> >that i suggested or something similar ? Do you know what
> >kind of error you can get away with ?
> 
> Much better:  You tell me what you are trying to do, and I will
> tell you ways you can attempt it.

I want to find performance problems in the kernel, and to this purpose,
sometimes i need to timestamp events in the kernel using the
least-intrusive technique i can use, and hopefully get reasonably
accurate estimates.

Sampling the 8254 takes way too much time, and the resolution is poor.
The TSTMP() macro, using the TSC, works great on UP, and it helped
me detect and fix several problems or suboptimal code in network
drivers and the network stack.

A slightly modified version of TSTMP is also useful on SMP
if all you need is to measure events occurring on the same processor.
However, to measure time differences between events occurring on
different CPUs you need to know an approximation of the skew between
clocks. If you can determine this skew with a resolution that is
in the order of say 100ns, then even using the TSC on different
processors can result in useful measurements.

So what do you suggest, and what kind of resolution do you think we
can achieve ?

	cheers
	luigi

> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020823144256.A82380>