I’m in the process of optimising some functions in Dynamics AX and need to be able to compare the processing times between the old function and my new function to see if I’m actually making any improvements on my code. However I struggled to find a nice function to retrieve milliseconds out of the system, as seconds are just too big a unit. Eventually I located a WinAPI function call that suits my needs nicely called WinAPI::getTickCount(); it returns “the number of milliseconds that have elapsed since the system was started, up to 49.7 days” (MS Documentation) So in code:
TimeInMS startTime,endTime;
;
startTime = WinAPI::getTickCount();
[PERFORM OPERATION]
endTime = WinAPI::getTickCount();
info(strfmt(‘%1 Milliseconds’,endTime-startTime));
;
startTime = WinAPI::getTickCount();
[PERFORM OPERATION]
endTime = WinAPI::getTickCount();
info(strfmt(‘%1 Milliseconds’,endTime-startTime));
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.