By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Get exact time

P: n/a
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
Mar 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Boni wrote:
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
Mar 15 '06 #2

P: n/a
"Boni" <no****@parampam.pam> wrote in message
news:OL**************@TK2MSFTNGP11.phx.gbl...
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
Mar 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.