Date: Sun, 4 Nov 2001 14:34:25 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alex Vinokur cc: djgpp AT delorie DOT com Subject: Re: Getting high resolution time In-Reply-To: <3BE52F3B.C4129F05@bigfoot.com> 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 Sun, 4 Nov 2001, Alex Vinokur wrote: > > Then you should abandon hope to have an accurate timing: Windows has its > > own ideas about what you need. > > > > Our `uclock' does a fairly good job on Windows as well, but be prepared > > to some surprises. > > I would like to make clear this point for Windows98 and gpp-2.95.3 > > I have some function foo(). > I would like to measure its average cost-time in nanoseconds, something like > : > > start = ???? > for (i = 0; i < iters; i++) > foo (); > end = ???? > printf("Avg time = %lld nsec\n", (end - start) / iters); > > Is it possible ? You didn't say what accuracy (as opposed to resolution) do you want this information. Without accyracy requirements, any answer is meaningless. `uclock' works with sub-microsecond resolution, but I doubt if its accuracy, especially on Windows is better than a few milliseconds. OTOH, you can always make that loop of yours iterate more times, so that any such lack of accuracy is made negligible.