delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/19/00:01:18

From: Richard Legner <rlegner AT whitehorse DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: uclock()
Date: Thu, 18 Feb 1999 20:25:25 -0600
Organization: Blackstone Janitorial Services
Lines: 28
Message-ID: <36CCCB95.AEA6D8FC@whitehorse.net>
NNTP-Posting-Host: 199.247.227.202
Mime-Version: 1.0
X-Trace: 919398309 VRL06/YYIE3CAC7F7C usenet55.supernews.com
X-Complaints-To: newsabuse AT remarQ DOT com
X-Mailer: Mozilla 4.07 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
{Compiled with DJGPP 2.8.1.}
<P>I found some very peculiar results when timing (to determine efficiency)
different search routines that I wrote. After heaps and stacks of debugging
frustration I took a closer look at the output of the code below (just
a loop that displays uclock() ticks).
<P>#include&lt;iostream.h>
<BR>#include&lt;time.h>
<P>int main(){
<BR>&nbsp;&nbsp;&nbsp; long ticks;
<BR>&nbsp;&nbsp;&nbsp; while (1) {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ticks = uclock();
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; ticks &lt;&lt;
endl;
<BR>&nbsp;&nbsp;&nbsp; }
<P>&nbsp;&nbsp;&nbsp;&nbsp; return 0;
<BR>}
<P>Sometimes (but not always) the following occurs:
<P>Running and pausing the program&nbsp; and CLOSELY inspecting the output
revealed that
<BR>while the values produced by uclock() follow a general ascending trend,
they
<BR>are&nbsp; by no means in order.
<P>What could be causing this?
<P>No wonder my searches sometimes take -654 uclock ticks to find the target.
<BR>&nbsp;</HTML>

- Raw text -


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