Computing cpu's clock in cycles per second
Michael Miles
mmamiga6 at gmail.com
Mon Sep 27 23:25:14 UTC 2010
JD wrote:
>
> On 09/27/2010 07:34 AM, Wade Hampton wrote:
>
>> Did you look at using the RDTSC instruction to read the
>> cycle counter?
>>
>> http://en.wikipedia.org/wiki/Time_Stamp_Counter
>>
>> Sample this over an interval to get an estimate
>> of the clock frequency based on this counter.
>>
>> __inline__ unsigned long long int rdtsc()
>> {
>> unsigned long long int x;
>> __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
>> return(x);
>> }
>>
>> I use gettimeofday() calls to check the wall-clock time,
>> usleep(n) to sleep for a long time (second or more),
>> and rdtsc to compute the cycles.... Seems to work
>> well.
>>
>> Cheers,
>> --
>> Wade Hampton
>>
> Thank you very much Wade.
> I confirm that using rdtsc, the delta in tsc values, divided by 60
> (using nanosleep)
> is 798283074.9833333333 ticks per second, which is almost iddentical
> to what is reported by cpuinfo:
> cpu MHz : 798.244
>
> No matter what the load factor on the machine, even when the load
> reached 5 or 6,
> it is the same value.
> Well, that's what you get for buying a laptop from a crappy manufacturer
> that has put in it a fixed unprogrammable clock (oscillator), and put in a
> lame BIOS that provides no hooks for setting C2 C3 ...etc.
> I will certainly steer friends and family away from this manufacturer.
>
>
>
I find the whole idea of a manufacturer purposely sabotaging a computer
in this manner just disgraceful.
This one really takes the cake since "cool and quiet" and "powernow" was
a big marketing scheme back then. You would think that the bios would at
least have something to say about it
I wonder if the machine in question was on windows if the cool and quiet
drivers would have something to enable/ disable them by software?
But then again if Bios does not support then that would be a no show too...
Very bad manufacturing screw up
Michael
More information about the users
mailing list