Nasser
Nasser

Reputation: 13173

How to find which dynamic objects taking excessively long time to finish?

M 8.0.1, windows 7.

A debugging question.

Sometimes when I start M and open my notebook (which has dynamics enabled in it before I closed it) I get this message

enter image description here

The problem is, no matter if I click on wait, or disable dynamics, the message keeps coming back.

I have to terminate the process itself (i.e. Mathematica) from windows task manager to get out of this.

Clearly I seem to have a bug somewhere in dynamics in my code.

My question is: Is there a way for M to tell me which dynamic objects is causing this problem? And any idea why telling it to disable dynamics updating is not helping here (as I keep getting the message).

thanks

Upvotes: 1

Views: 382

Answers (2)

ragfield
ragfield

Reputation: 2506

You may have some luck by evaluating:

SetOptions[$FrontEnd, PrintKernelDynamicTraffic -> True]

This will cause the Mathematica FrontEnd to print messages to the system console (on Mac, I don't know where it goes on Windows) whenever it sends Dynamic evaluations to the kernel. If you can find the last Dynamic evaluation to print out when the message appears, that should be the one which is taking a long time to evaluate.

You'll probably want to disable this when you're done debugging so it doesn't fill your system log with millions of debug messages.

Upvotes: 6

acl
acl

Reputation: 6520

You may find DebugTrace, written by David Bailey, useful. It is a debugger which may also be used to debug dynamic constructions. In this documentation there is an example on how to debug such programs. Basically you set a breakpoint in your code, run it, and after it's done you are presented with detailed information on what happened when.

In general I highly recommend giving it a try, not only for the dynamic functionality.

Upvotes: 4

Related Questions