From: Gero Timann Newsgroups: comp.os.msdos.djgpp Subject: Re: millisecond in C++ Date: Tue, 13 Oct 1998 20:23:19 +0100 Organization: MediaCompany Goe Lines: 61 Message-ID: <3623A8A7.D10D7453@mcis.de> References: NNTP-Posting-Host: x140.mcis.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.mcis.de 908303100 25266 194.221.140.140 (13 Oct 1998 18:25:00 GMT) X-Complaints-To: news AT mcis DOT de NNTP-Posting-Date: 13 Oct 1998 18:25:00 GMT X-Mailer: Mozilla 4.05 [de]C-NECCK (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi ! If you have a Pentium or above, you can also use the CPU-build-in time stamp counter. Counts with CPU-clock ! Reading TSC can look like this: ------------------------------------------------------------------------ // Read TimeStampCounter in double-format // Offset is 2.0, price for simple conversion routine extern void RDTSC(double *dst); #define RDTSC(_dst)\ __asm__(" rdtsc movl %%eax,(%%edi) orl $1073741824,%%edx movl %%edx,4(%%edi)"\ : : "D" (_dst) : "eax", "edx", "edi"); ------------------------------------------------------------------------ You can also count events, like floating point operations or memory reads, with a mechanism similar to the above. If you are interessted in a c-module, please send me a mail. Regards, Gero Wojciech Piechowski schrieb: > On Mon, 12 Oct 1998, Edouard Laroche-Joubert wrote: > > > I need to get the elapsed time between two steps and I only found how to get > > it in seconds but it's too long ! > > > > Is theire a way to get it in milliseconds or microseconds ? > > Use uclock() > > --------------------\ Wojciech Piechowski /---------------------------- > Student informatyki \ voyt AT ds2 DOT pg DOT gda DOT pl / Student of computer science > Politechnika Gdanska \________________/ Technical University of Gdansk -- ___________________________________________________________________ Dipl.Phys.Gero Timann Schülerstieg 20 37081 Göttingen Germany Tel./Fax: Germany-0551-96782 EMail: geti AT mcis DOT deREMOVE_THIS geti AT spock DOT physik3 DOT gwdg DOT deREMOVE_THIS geti AT online DOT deREMOVE_THIS ____________________________________________________________________