Get exact time

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

Dear all,
what is the most exact time interval I can get in .NET? I need some value
(i.e. number of ticks since program was started?), which will allow me to
remember a time of function call and mesure the time between calls.
Thanks a lot,
Boni
 
Boni said:
Dear all,
what is the most exact time interval I can get in .NET? I need some
value (i.e. number of ticks since program was started?), which will
allow me to remember a time of function call and mesure the time
between calls. Thanks a lot,

See QueryPerformanceCounter and QueryPerformanceFrequency on MSDN. If
you're using .NET 2.0, you can use the Stopwatch class (which uses QPC/QPF
under the covers).

-cd
 
Boni said:
what is the most exact time interval I can get in .NET? I need some value
(i.e. number of ticks since program was started?), which will allow me to
remember a time of function call and mesure the time between calls.

I see that Carl has already answered your question.

I'd just like to add that your application is not the only executable
component on a system so your results can be skewed due to all kinds of
factors. For example, your thread's quantum may be up immediately after you
call the QPC function. That's not to say that profiling is impossible, just
that you often needs lots of data and that the actual precision of your
measurements may be far less than you'd expect.

Regards,
Will
 
Back
Top