Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

marked as duplicate by R. M. Nov 25 '12 at 16:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Related questions: profiling-from-mathematica, and workbench-profile-question. Not fully sure, but this one may be a dupe of one of those. – Leonid Shifrin Nov 25 '12 at 15:49
up vote 4 down vote accepted

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

share|improve this answer
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) – R. M. Nov 25 '12 at 16:36
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. – Leonid Shifrin Nov 27 '12 at 11:32

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