How can I time a function?
-
I want to know how long a particular function in my program takes to run. How can I get the number of milliseconds between two DateTime objects? Or is there a better way to do this?
I'm no .net expert so I can only give you the Win32 way. Use QueryPerformanceCounter() and QueryPerformanceFrequency() Very high resolution timer, I used it all the time when doing game development on Win32. Milliseconds aren't really good enough for this sort of timing btw.
-
I want to know how long a particular function in my program takes to run. How can I get the number of milliseconds between two DateTime objects? Or is there a better way to do this?
-
I want to know how long a particular function in my program takes to run. How can I get the number of milliseconds between two DateTime objects? Or is there a better way to do this?
U can use the following idea.. int t1= Environment.TickCount; function(); int t2=Environment.TickCount; int t3=t2-t1; Console.Writleln("Time consumed : " + t3.ToString());