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

Application run timing in C#

P: n/a
How do I time my code? I can't find the old clock() routine.

Ray
Feb 3 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I don't know in which version of C# you were using "the old clock() routine"
but it must've been a very ancient one :-)

Try the System.Diagnostics.Stopwatch class (if you are using .NET 2.0) or
plain DateTime start = DateTime.Now; long timeElapsed =
start.Subtract(DateTime.Now).TotalMilliseconds; or QueryPerformanceCounter
from WinAPI, depending on your needs for timing resolution.

"rayreeves re****@verizon.net>" <ray<mondwrote in message
news:EC2xh.991$xu4.286@trndny04...
How do I time my code? I can't find the old clock() routine.

Ray


Feb 3 '07 #2

P: n/a
Much obliged, that does it.
clock() is still reachable from C++.

Ray
>I don't know in which version of C# you were using "the old clock()
routine" but it must've been a very ancient one :-)

Try the System.Diagnostics.Stopwatch class (if you are using .NET 2.0) or
plain DateTime start = DateTime.Now; long timeElapsed =
start.Subtract(DateTime.Now).TotalMilliseconds; or QueryPerformanceCounter
from WinAPI, depending on your needs for timing resolution.

Feb 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.