From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: Reading MSR (Athlon multiplier) Date: Thu, 18 Jan 2001 16:40:59 -0500 Lines: 143 Message-ID: <947nrf$cdrkr$1@ID-57378.news.dfncis.de> References: <3a66161d DOT 226362160 AT news DOT sci DOT fi> <945a90$ckgq1$1 AT ID-57378 DOT news DOT dfncis DOT de> <3a6746e4 DOT 36130587 AT news DOT sci DOT fi> NNTP-Posting-Host: pppa92-resalerochester3-5r7104.dialinx.net (4.4.210.25) X-Trace: fu-berlin.de 979854001 13037211 4.4.210.25 (16 [57378]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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" 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" > 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" 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 - > > > > >