AdrianSmithUK
asked on
Flash Timer Code: How to measure code execution time.
I'm using flash remoting and I need a script to measure the code execution time.
I tried using the script below but sometimes the result is negative. (eg -841ms)
Does anybody have a robust code execution timer function?
I tried using the script below but sometimes the result is negative. (eg -841ms)
Does anybody have a robust code execution timer function?
var t1:Date = new Date();
//Do something
var t2:Date = new Date();
trace(t2.getMilliseconds() - t1.getMilliseconds());
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Final solution:
import flash.utils.getTimer;
var t1:uint = getTimer();
//Do something
var t2:uint = getTimer();
var delay:uint= t2 - t1;
trace(delay);