Mail Archives: djgpp/1998/10/13/14:32:56
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
____________________________________________________________________
- Raw text -