"Syncing cpus" on a multi-cpu, dual core system
Joseph Koshy
joseph.koshy at gmail.com
Fri Dec 15 09:50:41 PST 2006
> frequency but something else in addition. A posting in the
> thread said variations less than 0.1% were not problematic.
> However, the poster said it was an issue in a dual cpu, dual
> core system he had set up.
Why would application code care about CPU frequencies?
Is it trying to measure its 'performance' by subtracting
two TSC readings? That won't necessarily work on
modern multi-CPU systems where each CPU could be running
at a different CPU speed.
On FreeBSD, with hwpmc(4), you can allocate a process-mode
counting pmc that counts non-sleep cycles (e.g.,
"p4-global-power-events,mask=running" on an Intel P4) and
then use RDPMC instructions where you would have used RDTSC
instructions. This is as cheap as the RDTSC technique and
will work on SMP systems.
--
FreeBSD Volunteer, http://people.freebsd.org/~jkoshy/
More information about the freebsd-hackers
mailing list