Skip to main content

Microsoft Silverlight

Code Execution TimeRSS Feed

(0)

Mike4268
Mike4268

Member

Member

24 points

29 Posts

Code Execution Time

I tried measuring a function using DateTime.Now and TimeSpan.TotalMilliseconds, but that returned either 0 or 15.664, and nothing inbetween.

The full .NET framework has a System.Diagnostics.StopWatch, which I believe is much more precise. Is there anything I can do in silverlight to get more precision?

Mike

robhouweling
robhouwe...

Contributor

Contributor

3184 points

548 Posts

Silverlight MVP

Re: Code Execution Time

Can you post your code so we can see if anything is going on with that?

(If this has answered your question, please click on mark as answer on this post)



Cheers!

Rob Houweling





My blog

Mike4268
Mike4268

Member

Member

24 points

29 Posts

Re: Code Execution Time

DateTime start, end;

start = DateTime.Now;

DoSomeStuff();

end = DateTime.Now;

TimeSpan ts = end - start;

Debug.WriteLine("Time: " + ts.TotalMilliseconds);

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities