delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/13/14:32:56

From: Gero Timann <geti AT mcis DOT de>
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: <Pine DOT GSO DOT 3 DOT 96 DOT 981012223325 DOT 24539A-100000 AT delta DOT ds2 DOT pg DOT gda DOT pl>
NNTP-Posting-Host: x140.mcis.de
Mime-Version: 1.0
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
____________________________________________________________________

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019