1

我在 Delphi 7 中编写了一个程序(包括一个使用 Indy 的 ModBus 组件)。在我的机器上,它使用 Indy 9 并且工作正常。它通过 ModBus 协议与其他机器进行良好的通信。但是,当程序在另一台机器上运行时,我会得到 90-100% 的 CPU 负载。不幸的是,这台机器不在我的办公室,而是“在世界的另一端”。如何确定这台机器使用的是 Indy 9 还是 Indy 10?而且,如果它正在运行 Indy 10,这可能是问题还是这不太可能?

4

5 回答 5

4

确定的答案是否定的

如果你用 indy 9 编译你的程序,即使使用包,它也应该使用 INDY 9 来运行。AFAIK,没有办法使用 INDY 9 编译可执行文件并在运行时使用 INDY 10,即使你愿意,也不会偶然发生。

于 2011-02-02T16:39:21.453 回答
1

要找到根本原因,您可以准备一个测试应用程序,该应用程序将执行一系列操作,例如打开/关闭连接。如果它在继续之前要求用户确认(“继续?是/否”),用户可以检查每个步骤的 CPU 负载以检测关键操作。

于 2011-02-02T16:41:11.933 回答
1

要找出导致高 CPU 负载的原因,您可以尝试使用AQTimeSamplingProfiler之类的分析器。

这将为您提供大部分时间都在运行的方法。然后,您将能够找出导致问题的原因。

或者,您可以向您的应用程序添加一些日志记录。

于 2011-02-02T08:54:53.507 回答
0

you need to add logs to ensure you know whats going on.

is it the connection itself that is causing you the issue? or is it the work performed while connected?

Logs will help you narrow this down and you may be able to alter you code to be less processor hungry.

using AQTime or SamplingProfiler as also suggest earlier will help you.

personally i always add logging to every application by default, alot of them require turning on but its there. Once the software it on site you never know what may change and simply turning the logs on can save you alot of time

于 2012-02-19T21:21:29.267 回答
0

感谢您的回答。我不认为这是印地的问题。在我的 Quad CPU PC 上,CPU 负载也从 1-2% 上升到大约。25%。如果我保持线路打开(连接),就会发生这种情况。但是,如果我在每次从 ModBus 客户端端轮询后断开 ModBus 服务器并让那台 PC 重新连接,CPU 负载总是很低。什么是正常的?让线路一直打开,或者每次投票都连接和断开连接?轮询频率为:空闲模式:2000ms,活动模式500ms。

于 2011-02-08T09:05:24.043 回答