You need to sign in to do that
Don't have an account?
ambiti
How to get the time spent running a sript?
I'm new here,please help me.
While doing a math operation,like 1+1 million times,how can I get the time spent running this code? In php there's a microtime() function to do this, is there a samilar funciton in Apex?
I don't know if this is what you were looking for.
Long start = System.now().getTime();
Integer i = 0;
while (i < 100000){
i++;
}
Long miliseconds = System.now().getTime() - start;
System.debug(miliseconds);
That'd show the number of miliseconds spent in the proccess.
Hope this helps.
All Answers
I don't know if this is what you were looking for.
Long start = System.now().getTime();
Integer i = 0;
while (i < 100000){
i++;
}
Long miliseconds = System.now().getTime() - start;
System.debug(miliseconds);
That'd show the number of miliseconds spent in the proccess.
Hope this helps.
Thanks for your attention!