delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/01/06:44:41

From: "Mr. Veli Suorsa" <VJSuorsa AT Surfeu DOT Fi>
Sender: vjsuorsa AT Surfeu DOT Fi
To: djgpp AT delorie DOT com
Cc: "Tom St Denis" <tomstdenis AT yahoo DOT com>
Date: Sun, 1 Apr 2001 13:40:50 +0300
Subject: Re: Any comments about using RDTSC to sync code ?
X-Mailer: CWMail Web to Mail Gateway 2.6k, http://netwinsite.com/top_mail.htm
Message-id: <3ac705b2.707.0@surfeu.fi>
X-User-Info: 193.167.106.194
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Hi!

>"Eduardo TUDA Lorenzetti Pellini" <dochell AT MailAndNews DOT com> wrote in message

>news:3ACABB23 AT MailAndNews DOT com...
>> Hi DJGPP friends,
>>
>> I'm doing a real time app using DJGPP that runs for almost 2 hours polling

>> and
>> reading some hardware ports in loops of 50 usec (*micro*seconds).
>> I'm using the Pentium TSC counter to sync the data acquision since the RTC

>> and
>> system timer don't have this desired resolution or have some undesired
>> granularity.
>>
>> The first problem i am living is to accurately calculate the CPU clock to

>> stablish the relationship between system clocks and real time.
>>
>> The second problem is that (i think) PC hardware don't have any
>> stabilization
>> method for the CPU internal clock (Xtal voltage and temperature
>regulation).
>> So i think that the CPU clock may vary, but i don't know how much.
>
>Typically it's about 10%.  My athlon 1200mhz runs at "supposedly" 1211mhz
>according to various programs.

I think that it is typically smaller than 10 %, yours pc vary seems to be quite
good, under 1%.

>> The third problem is about the TSC reading routine (RDTSC) and the 64 bits

>> arithmetic involved to calculate the elapsed time. They impact on the CPU,

>> but
>> i don't know how much. On a Pentium 100 system I estimated that RDTSC
>takes
>> from 12 to 24 clocks to finnish. And about the 64 bits arithmetic ? DJGPP

>> supports it, but i don't think that the operations are somehow hardware
>> accelerated. Am i right ? Are there any WWX (the oposite of MMX 8)
>> instructions on any Intel/AMD class processor that could be used by DJGPP

>or
>> inline assembler ?

I take a "RDTSC"- query from Google:
http://www.google.com/search?q=RDTSC&hl=fi&lr=

(about 6000 articles from RDTSC and 7 million from CPU ;-).

Maybe you will find the answer to your inquiries from there, too.

>Well you can do 64-bit math on an x86 several ways.  The x86 set does have

>"add/sub" with carries so you can add a 64-bit word in two cycles.  You can

>multiply one in about 10 or so... etc..
>
>Using RDTSC to sync programs is a bad idea since RDTSC may take a variable

>amount of cycles to complete.
>
>Tom

P.S. Mr. Pellini has beautiful antique pictures and curves on his homepages
(http://www.pea.usp.br/~epellini). Are these all made by OpenGL? What is this
program?

Best luck!

Veli Suorsa
---
"People must believe to the future to be able to live!"
---------------------------------- J.V.Snellman, 1890.

Oulu, FINLAND
Mailto:VJSuorsa AT Surfeu DOT Fi
http://members.surfeu.fi/veli.suorsa/
http://www.surfeu.fi

- Raw text -


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