From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: Reading MSR (Athlon multiplier) Date: Thu, 18 Jan 2001 12:57:17 -0500 Lines: 95 Message-ID: <947ao2$ca654$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> <945itn$3ai$1 AT nnrp1 DOT deja DOT com> <945mn8$cjroo$1 AT ID-57378 DOT news DOT dfncis DOT de> <946ofe$vlp$1 AT nnrp1 DOT deja DOT com> <946rg8$c61d6$1 AT ID-57378 DOT news DOT dfncis DOT de> <9471af$7r4$1 AT nnrp1 DOT deja DOT com> NNTP-Posting-Host: pppa93-resalerochester3-5r7104.dialinx.net (4.4.210.26) X-Trace: fu-berlin.de 979840581 12916900 4.4.210.26 (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 oh man, you're not understanding the issue at all. do you? okay, you suuggest that I use the following code in order to compute the overhead involved by "push eax/edx": -------8<-------- mov ebp,128 l1: rdtsc push eax push edx rdtsc pop eax pop edx add ebx,eax adc ecx,edx dec ebp jnz l1: shrd ebx,ecx,7 -------8<-------- now notice that i have this overhead every time the loop is executed (see my source). e.g. i always have a value given by RDTSC a little bit greater/lower/whatever, but this "overhead" is always constant in the loop. now, if i subtract two values I got from RDTSC withing 2 consecutive loops, I get a rid of this overhead. I do not have to take in account this overhead. okay, if you still don't get me, let's go for a simple example... let's imaging we have a ruler and a pen, we want to measure (length of a pen): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| <-- ruler <------------------------------------> <-- pen from this you can see that pen length is 11 units (cms, I guess) let's imaging a new picture: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| <-- ruler <------------------------------------> <-- pen same pen shifted 2 units left. the pen length remains the same, though now we should calculate 13-2=11 units (as opposed to 11-0=11 units) this is what I'm talking about. the analogy is direct. and if you still don't get it, just quit or come up when you finally get what I'm talking about. 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/ "Tom St Denis" wrote in message news:9471af$7r4$1 AT nnrp1 DOT deja DOT com... > In article <946rg8$c61d6$1 AT ID-57378 DOT news DOT dfncis DOT de>, > "Alexei A. Frounze" wrote: > > it does not really matter. you know why? because the only thing we want is > > having that value from RDTSC after a certain period of time. it doesn't > > matter what CPU does meanwhile (messes with kernel code or user task or with > > the stack you meantion). and even if you talk about the overhead, this > > overhead simply shifts everything in time (e.g. adds the same constant value > > to the value from RDTSC). and when we compute the difference this "overhead" > > disappears. do you care about value of (say) (5-2) more than about value of > > (7-4)??? > > btw, if there was something like that overhead, it would have less > > contribution to the measured frequency rather than contribution of timer > > accuracy and BIOS code which increments the counter at 40h:6ch. > > well on my Athlon it takes about 10~15 cycles (I think) todo the following > > rdtsc > mov [start],eax > mov [start+4],edx > call myfunc > rdtsc > > myfunc: > ret > > > So there is obviously some overhead in the code. By subtracting out the 10 > cycles you get zero based RDTSC counts. > > Tom > > > Sent via Deja.com > http://www.deja.com/