delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/18/15:07:23

From: tronic2 AT sci DOT fi DOT don'tSPAMmeBUTremoveTHIS (Lasse Kärkkäinen / Tronic)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Reading MSR (Athlon multiplier)
Date: Thu, 18 Jan 2001 19:45:27 GMT
Organization: SAUNALAHDEN asiakas
Lines: 123
Message-ID: <3a6746e4.36130587@news.sci.fi>
References: <3a66161d DOT 226362160 AT news DOT sci DOT fi> <945a90$ckgq1$1 AT ID-57378 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: dyn-1-054.tku.netti.fi
X-Trace: tron.sci.fi 979847124 17898 195.16.222.55 (18 Jan 2001 19:45:24 GMT)
X-Complaints-To: newsmaster AT saunalahti DOT fi
NNTP-Posting-Date: 18 Jan 2001 19:45:24 GMT
X-Newsreader: Forte Free Agent 1.21/32.243
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019