Re: rdtsc timecounter

2012-08-16 Thread Ted Unangst
On Thu, Aug 16, 2012 at 14:00, Mark Kettenis wrote: > A whitelist-based approach is probably best. What you could do is > attach this timecounter on platforms that are not whitelisted as well, > but give it a fairly low tc_quality if it isn't whitelisted. That way > people can still select the TS

Re: rdtsc timecounter

2012-08-16 Thread Mark Kettenis
> Date: Wed, 15 Aug 2012 13:25:55 -0400 > From: Ted Unangst > > So for more than a decade, the rdtsc instruction has in theory been > the fastest most accurate way to measure elapsed time on x86. Except > when it doesn't quite work. It's not obvious though that it is the most stable clock in th

Re: rdtsc timecounter

2012-08-15 Thread Franco Fichtner
On Aug 15, 2012, at 8:17 PM, Ted Unangst wrote: > On Wed, Aug 15, 2012 at 13:25, Ted Unangst wrote: > > I will probably rename this just "tsc" after some prodding from mikeb, > that's a better name. I tend to focus on the instruction used, but we > should name it after the counter. > >> +r

Re: rdtsc timecounter

2012-08-15 Thread Ted Unangst
On Wed, Aug 15, 2012 at 13:25, Ted Unangst wrote: I will probably rename this just "tsc" after some prodding from mikeb, that's a better name. I tend to focus on the instruction used, but we should name it after the counter. > + rdtsc_timecounter.tc_frequency = cpuspeed; > + /* cpuspeed

rdtsc timecounter

2012-08-15 Thread Ted Unangst
So for more than a decade, the rdtsc instruction has in theory been the fastest most accurate way to measure elapsed time on x86. Except when it doesn't quite work. The main issues are 1) frequency changing as a result of power management, and 2) different values on different CPUs in SMP systems.