Re: Timing function call



"Bruno van Dooren [MVP VC++]" <bruno_nos_pam_van_dooren@xxxxxxxxxxx> wrote
in message news:963A32CE-EBD9-4E48-A923-0B7FD7E69F11@xxxxxxxxxxxxxxxx
You can use the Stopwatch class to do that very easily. See MSDN for more
info.

A note of caution if you want to use ns precision:
(From this thread:
http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/7ed4163c3b487c46/6f3c2bcaba6ff09c?&hl=en#6f3c2bcaba6ff09c
)

"One should not use Elapsed.Ticks to calculate the elapsed time in
nanoseconds.
The only correct way to get this high precision count is by using
Stopwatch.ElapsedTicks like this:

<G> Been there, done that. Brilliant design that Stopwatch.Elapsed.Ticks
and Stopwatch.ElapsedTicks are both valid but have radically different
meanings.

-cd


.



Relevant Pages

  • Re: allocating arrays, trouble
    ... Two different meanings of "kind" are ... I use compilers both with and without quad precision, ... One well-known method that does work in f95 is ...
    (comp.lang.fortran)
  • Re: clock() problem - measuring cycles
    ... This is a very platform-dependent thing to do. ... you could always loop your calculations by some arbitrarily ... and take the elapsed time for the entire ... reasons--the least of which is the lack of precision your platform may ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Down with the strong 2C
    ... have two meanings, either the usual or any hand that you want to make ... If you want a forcing 1C opening, what's wrong with Precision? ...
    (rec.games.bridge)
  • Elapsed time in thousands or hundreds
    ... as in the command tic / toc? ... I need more precision for the displayed elapsed time. ... Ashraf Awad ...
    (comp.soft-sys.matlab)