如何找到哪些动态对象需要很长时间才能完成?

发布于 2024-11-30 08:44:49 字数 312 浏览 4 评论 0原文

M 8.0.1,windows 7。

一个调试问题。

有时,当我启动 M 并打开笔记本(在关闭笔记本之前已启用动态功能)时,我会收到此消息

是,无论我单击“等待”还是禁用动态,该消息都会不断返回。

我必须从 Windows 任务管理器终止进程本身(即 Mathematica)才能摆脱这种情况。

显然,我的代码中的动力学方面似乎有一个错误。

我的问题是:M 有没有办法告诉我哪些动态对象导致了这个问题?任何想法为什么告诉它禁用动态更新在这里都没有帮助(因为我不断收到消息)。

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黎夕旧梦 2024-12-07 08:44:49

您可能会通过评估获得一些运气:

SetOptions[$FrontEnd, PrintKernelDynamicTraffic -> True]

这将导致 Mathematica 前端在向内核发送动态计算时将消息打印到系统控制台(在 Mac 上,我不知道它在 Windows 上的位置)。如果您可以在消息出现时找到要打印的最后一个动态评估,则该评估应该是需要很长时间才能评估的评估。

完成调试后,您可能希望禁用此功能,这样它就不会用数百万条调试消息填充您的系统日志。

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.

花开浅夏 2024-12-07 08:44:49

您可能会发现 David Bailey 编写的 DebugTrace 很有用。它是一个调试器,也可用于调试动态结构。本文档中有一个有关如何调试此类程序的示例。基本上,您在代码中设置一个断点,运行它,完成后您会看到有关何时发生的详细信息。

总的来说,我强烈建议尝试一下,不仅仅是为了动态功能。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文