From: Eduardo TUDA Lorenzetti Pellini Newsgroups: comp.os.msdos.djgpp Subject: Any comments about using RDTSC to sync code ? Date: Sat, 31 Mar 2001 23:13:48 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <3ACABB23@MailAndNews.com> X-InterChange-Posted-By: dochell AT MailAndNews DOT com Sender: Eduardo TUDA Lorenzetti Pellini X-EXP32-SerialNo: 50000000 Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: InterChange (Hydra) News v3.61.08 X-Complaints-To: newsabuse AT supernews DOT com Lines: 43 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie 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. 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 ? Thanks in advance for all And grettings from Brazil ! 8)) Eduardo TUDA DocHell Lorenzetti Pellin PEA - Electrical Energy and Automation Department USP - Politechnical School of Sao Paulo University - BRAZIL http://www.pea.usp.br/~epellini --------------------------------- And if you have a time to loose, an open mind, and right to choose, would you care to take a look, or can you read me like a book... time's is allways on my side... --------------------------------- (Up the Irons !!!)