I want to find the computational time (CPU time) of my code.
When I use TimeUsed
or Timing
commands they give the CPU time of only one cell. But my program contain many expressions including loops, is there any way to find CPU time of more than one expressions?
Or is there any way to find the starting time of computation and ending time of computation.
Thanks blochwave for giving me a detailed answer, but I have already used all these methods and none of them has worked well, it is clearly written in mathematica "get help" file that the Timing
and AbsoluteTiming
calculates the time of ONE expression only , and when I use in one cell with your suggestion. it gives me time of my code 0.0156 and using on all other codes the result is same 0.0156, no change with other codes, it means it is giving the time of only one expression as i have all my codes have first expression same but their other are different and complicated expressions, I have also used ClearSystemCache
so to avoid the the memorized values but getting same result.
starttime = AbsoluteTime[];...;endtime = AbsoluteTime[]; endtime-starttime
would give an idea. $\endgroup$AbsoluteTiming[expr1;expr2;expr3;]
$\endgroup$RuntimeTools`Profile
for this to work properly, but it should let you know where the time is being spent if you get it working. $\endgroup$