Getting total time taken of executing a method

Hi

I want to calculate total time taken of executing a method, I have writtem a job , however it returns only till seconds. If I change the sleep to 100 it returns blank since the process took milliseconds to complete .

I want that milliseconds also if the process executes in milliseconds.


Args args;
FromTime startTime = timeNow();//DateTimeUtil::getSystemDateTime();
print(“DOnme”);
sleep(1000);

info(strFmt(“Total time taken To execute is %1”,timeConsumed(startTime,timeNow())));
pause;


Kindly Help

You’ve posted this twice. Anyhow, how about ticks? http://www.artofcreation.be/2011/02/06/x-performance-tips/

ya by mistake I posted it twice … However how can I use ticks for hours,minute , seconds and milliseconds in the same job .

Never used ticks … :frowning:

Thanks

Ticks are basically milliseconds. Take a look here: http://msdn.microsoft.com/en-us/library/ms724408%28VS.85%29.aspx

So, something like this.

TimeInMS startTime,endTime;
;
startTime = WinAPI::getTickCount();
(do stuff)
endTime = WinAPI::getTickCount();
info(strfmt(‘%1 Milliseconds’,endTime-startTime));

Thanks :slight_smile: