ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/24/00:45:23

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Wed, 24 Apr 2002 08:42:16 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alex Vinokur <alexvn AT bigfoot DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: uclock_t & gcc 3.0.4 on Windows-2000
In-Reply-To: <aa5bqv$7v7pd$1@ID-79865.news.dfncis.de>
Message-ID: <Pine.SUN.3.91.1020424083902.4915B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 24 Apr 2002, Alex Vinokur wrote:

> | > So, what is alternative ?
> | > * rusage ? Does it work ?
> | > * something else ?
> |
> | It depends on what are you trying to accomplish.  Can you tell some
> | more details?
> 
> For instance, something like (pseudo-code) :
> 
> 
> void foo ()
> {
>     start_time = some-get-time-function();
>     // stuff
>     end_time = some-get-time-function();
>     assert (start_time  <= end_time);
>     cout << (end_time  -  start_time) << endl;
> }
> 
> int main ()
> {
>     for (int i = 0; i < TOTAL-ITERATIONS; i++)
>    {
>       foo ();
>    }
> }

Yes, but what is this for?  This is a toy program; I was interested to 
hear about some real-life application which needs that.

The important question is: can you settle for the basic 54-msec 
resolution of the standard PC clock?  If you can, use `clock' (or 
compile with -pg and use Gprof); if not, you will have to write some 
inline assembly using the RDTSC (sp?) instruction.  (I think someone 
posted such assembly here some time ago, so searching the DJGPP archives 
might find it.)

- Raw text -


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