Mail Archives: djgpp/2001/11/04/07:38:43
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.
- Raw text -