Possible Duplicate:
Profiling from Mathematica

How can I easily get fractions of timing for each nested function?

Consider a nested call like this:

Total[DigitCount[Mod[(2^10000) + 1, Prime[100]]]]

I don't want to assign each parameter to a variable and wrap Timing around it, but looking for a way to wrap the hole expression with Timing and get fractions of total time for each function.


1 Answer 1


According to Leonid Shifrin recommendation:

Put your Mathematica session in debug mode by going to Evaluation->Debugger

F[x_] := Total[DigitCount[Mod[(2^10000) + 1, Prime[x]]]]

Table[F[x], {100000}]; // RuntimeTools`Profile

enter image description here

  • $\begingroup$ I've closed this as a duplicate (since it is), but you can mark your own answer as accepted (I don't know if you have to wait a few hours) $\endgroup$
    – rm -rf
    Commented Nov 25, 2012 at 16:36
  • 1
    $\begingroup$ Well, thanks for ackowledging, but the recommendation was really not mine - I merely pointed to that discussion, the real credit goes to those who provided the answers there. $\endgroup$ Commented Nov 27, 2012 at 11:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.