From: "Andris Pavenis" Newsgroups: comp.os.msdos.djgpp Subject: Re: A question about DJGPP's clock?() Date: Tue, 03 Mar 1998 05:35:58 -0600 Organization: Deja News - The Leader in Internet Discussion Lines: 44 Message-ID: <6dgpu3$qru$1@nnrp1.dejanews.com> References: <34FB744B DOT D26C1712 AT concentric DOT net> NNTP-Posting-Host: postnews.dejanews.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <34FB744B DOT D26C1712 AT concentric DOT net>, "D. Huizenga" wrote: > > Hi, > > I have a quick question about clock(). Does DJGPP have a way to > increase the 'resolution' of the time returned by this function? I don't > care if it's standard/portable.. If something similar to this can be > done with Allegro, that would be good to. Thanks for your help. > > -- If You really don't nead portability and You using PENTIUM OR BETTER CPU then why not to use Pentium timestamp counter. It is very easy to read it. #define RDTSC(_dst) \ __asm__(" .byte 0x0F,0x31 movl %%edx,(%%edi) movl %%eax,4(%%edi)"\ : : "D" (_dst) : "eax", "edx", "edi") long long A; RDTSC(&A); should get time in variable A; Note that timestamp counter counts CPU clocks so You need to divide result with CPU clock frequency to get seconds. This code should work also under Linux. This macro is a fragment from post to this mailing list about 1.5 years ago. Subject: P5 Profiling Date: Fri, 6 Sep 1996 11:02:27 +0000 From: "Kevin Baca" To: djgpp AT delorie DOT com Andris Pavenis -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading