Profiler
Monkey Forums/Monkey Code/Profiler
| ||
I wrote a very simple Profiler to measure time in Milliseconds. It will call the enclosed code 100 times and then print out the average it took. [monkeycode] Strict #Rem --------------------------------------------------------------------------- Use to messure performance in Millisecs() Just enclose the part you want to messure with the following code: Profiler.Start() yourcode() Profiler.Stop() --------------------------------------------------------------------------- #End Class Profiler Global start:Int Global calls:Int Global average:Float Function Start:Void () start = Millisecs() If calls > 99 calls = 0 average = 0.0 End End Function Stop:Void () Local result:Int = Millisecs() - start average += result calls += 1 If calls > 99 Print "Average of 100 calls: " + (average / calls) End End End [/monkeycode] |
| ||
Thank you for sharing |