Mail Archives: djgpp/2001/01/18/16:52:13
It's okay to have a certain dispersion of values because you run this thing
under windows. If you ran it under DOS or in your own OS - you can get a
very precise value.
--
Alexei A. Frounze
alexfru [AT] chat [DOT] ru
frounze [AT] ece [DOT] rochester [DOT] edu
http://alexfru.chat.ru
http://members.xoom.com/alexfru/
http://welcome.to/pmode/
"Lasse Kärkkäinen / Tronic" <tronic2 AT sci DOT fi DOT don'tSPAMmeBUTremoveTHIS> wrote
in message news:3a6746e4 DOT 36130587 AT news DOT sci DOT fi...
> Thanks a lot! I wrote my own version based on your example, works
> great (on my 650MHz Athlon, where WCPUID gives 654MHz (I trust on it
> and it is really accurate), my own version gives mostly 654MHz, but
> sometimes 652-655) ...
>
> I still need to get the multiplier from MSR, but I can't read MSRs.
>
> - Tronic -
>
> On Wed, 17 Jan 2001 18:36:57 -0500, "Alexei A. Frounze"
> <dummy_addressee AT hotmail DOT com> wrote:
>
> >right, you can use RDTSC for getting CPU speed. But RDTSC can be disabled
in
> >user mode (e.g. Privilege Level 3) by an OS.
> >for instance, the following code works fine on my Celeron566 imder winME
and
> >gives 564-566MHz:
> >-------8<------
> >; cpuspeed.asm
> >; compile with nasm as follows:
> >; nasm.exe cpuspeed.asm -o cpuspeed.com
> >
> >section .text
> >org 100h
> >
> >push byte 40h
> >pop es
> >
> >mov ch, 17 ; 17 values for average of 16 periods
> >l1:
> >call wait_for_tick
> >rdtsc
> >push edx
> >push eax
> >dec ch
> >jnz l1
> >
> >xor cl, cl
> >xor ebx, ebx ; allocate cl:ebx for the sum
> >pop eax
> >pop edx
> >mov ch, 16
> >l2:
> >pop esi
> >pop edi
> >sub eax, esi
> >sbb edx, edi
> >add ebx, eax
> >adc cl, dl
> >mov eax, esi
> >mov edx, edi
> >dec ch
> >jnz l2
> >
> >mov eax, ebx
> >movzx edx, cl ; edx:eax = total sum of 16 values
> >shrd eax, edx, 4 ; eax = average value
> >
> >mov ebx, 182
> >mul ebx ; mul by 18.2*10 (18.2 timer ticks per second)
> >mov ebx, 10000000
> >div ebx ; div by 1e6*10 to get frequency in MHZ instead of HZ
> >
> >mov bx, 10
> >xor ch, ch
> >l3:
> >xor dx, dx
> >div bx
> >push dx
> >inc ch
> >or ax, ax
> >jnz l3
> >
> >mov ah, 2
> >l4:
> >pop dx
> >add dl, "0"
> >int 21h
> >dec ch
> >jnz l4
> >
> >mov ah, 9
> >mov dx, msg
> >int 21h
> >
> >ret
> >
> >wait_for_tick:
> >mov ax, [es:6ch]
> >.1:
> >cmp ax, [es:6ch]
> >je .1
> >ret
> >
> >msg db " MHz",13,10,"$"
> >-------8<------
> >
> >Good Luck
> >--
> >Alexei A. Frounze
> >alexfru [AT] chat [DOT] ru
> >frounze [AT] ece [DOT] rochester [DOT] edu
> >http://alexfru.chat.ru
> >http://members.xoom.com/alexfru/
> >http://welcome.to/pmode/
> >
> >"Lasse Kärkkäinen / Tronic" <tronic2 AT sci DOT fi DOT don'tSPAMmeBUTremoveTHIS>
wrote
> >in message news:3a66161d DOT 226362160 AT news DOT sci DOT fi...
> >> Hi!
> >>
> >> Multiplier of Athlon processor should be readable by MSR 0xC0010015,
> >> but I can't read it, or any other MSR (and believe it or not I have
> >> tried to find info on it, NOTHING anywhere). So, how to read one?
> >>
> >> Another thing related to this, I need to find out the processor speed.
> >> This is done with time stamp counter (isn't it?), which is also in
> >> MSRs, right? Anyway, I'll need to read this one too.
> >>
> >> Thanks.
> >>
> >> - Tronic -
> >
> >
>
- Raw text -