[fpc-pascal] How to find where my app consumes CPU?

Bo Berglund bo.berglund at gmail.com
Wed May 19 19:00:56 CEST 2021


On Wed, 19 May 2021 16:02:00 +0200, Bo Berglund via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>The "other" items might be hidden inside other used classes such as the Indy10
>components I use to implement the TCP/IP communications.
>But when searching for sleep through the complete project sources I came up
>empty-handed.
>Something else must be going on.
>
>I have a thread to handle the measuring sequence server and this uses timers
>(TFpTimer) in order to check if it is time to run a task, but when idling no
>task is running so no task execution thread spins off either...

So now I am down to the timers...
I am using TFPTimer timers in the scheduler to handle various things, some of
them are just one-shots to delay an action for some predetarmined time.
These are only executing as one-shots.
But the schedule timer restarts itself with an interval of 60 s.
Another timer is used to handle a message queue between parts of the system. It
runs at a shorter time, like a second or so. Restarts itself too.
But it runs only if scheduling is active.

I have no idea how TFpTimers work internally, maybe these cause extra CPU cycles
while waiting for the time they should fire?
I could switch off the scheduling timer, but it made no difference.
The other timers running for other purposes I canot disable.
An these fire more often.

Right now the server is running at 10% when doing nothing, not even checking
schedules...
After I did a service restart it drops to about 5%


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list