There is a very useful function timeConsumed() in Global class which we can use to calculate the time taken to execute business logic in AX 2012.
This function will return time consumed string in the form of X hours X minutes X seconds. If X is 0 – will not include the value + text.
It handles up to a 24 hour time difference not dependent on start/end time. If time consumed > 24 hours will only report time over 24 hour intervals.
Below is the example:
static void SGX_timeConsumed(Args _args)
FromTime startTime = timeNow();
for (i = 1 ; i <= 500000; i++)
dummyStr += int2str(i);
info(strFmt("Total time consumed is %1", timeConsumed(startTime, timeNow())));
Sreenath Reddy G