1

I have written a program in Delphi 7 (includes a ModBus component that uses Indy). On my machine it uses Indy 9 and works fine. It communicates well with other machines via a ModBus protocol. However, when the program is run on a different machine, I get a CPU 90-100% load. Unfortunately this machine is not in my office but "on the other side of the world". How can I find out whether this machine is using Indy 9 or Indy 10? And, further, If it is running Indy 10, could that be the problem or is this very unlikely?

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467

5 Answers5

4

Definitive answer is No

If you compile your program with indy 9, even if using packages, it shall use INDY 9 to run. AFAIK, there's no way to compile the executable using INDY 9 and use INDY 10 at runtime, even if you want, and no way it happen by accident.

jachguate
  • 16,976
  • 3
  • 57
  • 98
1

To find out whats causing the high CPU load you might try a profiler like AQTime or SamplingProfiler.

That will get you the method(s) that are running most of the time. Then you will be able to find out whats causing the problem.

Alternatively you could add some logging to your application.

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
1

To find the root cause you could prepare a test application which will go through a sequence of actions like opening / closing connections. If it asks the user for confirmation ("Continue ? y/n") before proceeding, the user can check the CPU load for every step to detect the critical operation.

mjn
  • 36,362
  • 28
  • 176
  • 378
0

Thanks for answers. I do not think this is an Indy issue though. On my Quad CPU PC the CPU load also goes up from 1-2 % to aprox. 25%. This happens if I keep the line open (connected). If I, however, disconnect the ModBus Server after every poll from the ModBus CLient side and let that PC reconnect, the CPU load is always low. WHat is normal? Having the line open all time, or connect and disconnect for every poll? The polling frequency is: in Idle mode : 2000ms, in active mode 500ms.

  • 25% CPU on a quad core = 100% of one of the cores – Marjan Venema Feb 08 '11 at 09:06
  • Plus: if you had logged in with the account used to ask the question, you could have edited the answer, instead of adding an answer to your own question (or maybe you did, and just changed the label?). In any case StackOverflow allows editing specifically to avoid long back and forth question and answer threads. – Marjan Venema Feb 08 '11 at 09:08
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

Shaun07776
  • 1,052
  • 1
  • 10
  • 16