Application run timing in C#

  • Thread starter Thread starter rayreeves
  • Start date Start date
R

rayreeves

How do I time my code? I can't find the old clock() routine.

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.
 
Much obliged, that does it.
clock() is still reachable from C++.

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top