Mail Archives: djgpp/1998/03/03/06:45:27
In article <34FB744B DOT D26C1712 AT concentric DOT net>,
"D. Huizenga" <skis AT concentric DOT net> 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" <kbaca AT skygames DOT com>
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
- Raw text -