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 X-Sender: eliz AT is To: Alex Vinokur cc: djgpp AT delorie DOT com Subject: Re: uclock_t & gcc 3.0.4 on Windows-2000 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.)