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

Bo Berglund bo.berglund at gmail.com
Wed May 19 21:51:27 CEST 2021


On Wed, 19 May 2021 19:46:43 +0100, Martin Wynne via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>On 18/05/2021 20:59, Bo Berglund via fpc-pascal wrote:
>> I have a pretty sizable console app written with Delphi 15 years ago but ported
>> to Linux using FreePascal (3.2.0) with Lazarus (2.0.12) as IDE.
>
>I have the same problem with high CPU usage for a 20-year-old Delphi App 
>compiled in Lazarus(2.0)
>
>When run in debug mode within the Lazarus IDE it runs fine.
>
>When run stand-alone as a Windows exe the CPU usage shoots up to 30% and 
>stays there.
>
>I found that the problem is in the Lazarus Application.OnIdle event, 
>which fails to honour the Done parameter and runs continuously:
>
> 
>http://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Forms.TApplication.OnIdle
>
>Martin.

The link you posted shows a page where Forms are used. My app does not use
Forms.

Is your application a GUI type app?

Mine is specifically ported to be a non-GUI console app so there are no
GUI-realted items in there like Form dependencies. For example
Application.Processmessages is totally non-existent.

I had a lot of trouble removing all of the GUI-related stuff from the Delphi
code when porting. Had to rewrite parts of the underlying system to get it done.


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list