<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
In the end we have a black box with Indy that isn't going to be opened.. and from the sound of it, a dated method of manually checking for i/o (in this case likely with select() and a zero timeout..). Calling that and sleep() over and over millions of times..<span id="ms-outlook-android-cursor"></span><br>
<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
I'm sorry to the OP if I'm assuming a lot but my guess is the code is a bit old and could use some refactoring to do away with the old Pascal "active loop."</div>
<div><br>
</div>
<div id="ms-outlook-mobile-signature">--<br>
Alexander Grotewohl<br>
<a href="https://dcclost.com" target="_blank">https://dcclost.com</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> fpc-pascal <fpc-pascal-bounces@lists.freepascal.org> on behalf of Bernd K. via fpc-pascal <fpc-pascal@lists.freepascal.org><br>
<b>Sent:</b> Saturday, October 23, 2021 6:46:21 AM<br>
<b>To:</b> fpc-pascal@lists.freepascal.org <fpc-pascal@lists.freepascal.org><br>
<b>Cc:</b> Bernd K. <prof7bit@gmail.com><br>
<b>Subject:</b> Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 07.10.21 um 19:41 schrieb Bo Berglund via fpc-pascal:<br>
<br>
> The question is: how to find what is still using CPU? <br>
<br>
Have a look at the tool sysprof. This is a statistical sampling profiler <br>
that can show you a call tree with percentages of CPU consumption. Thee <br>
are also other sampling profilers around (oprofile, perf/hotspot, <br>
google-gperftools, etc..) that all work by the same principle, you could <br>
try which one suits you best. They should all be able to tell you where <br>
exactly it spends how much of its CPU time. You don't need to instrument <br>
the code, just compile it with dwarf debug info contained in the <br>
executable (not as external debug file), maybe also reduce the <br>
optimization level if, and it should be able to show you the call tree <br>
along with time consumption of each function.<br>
<br>
Bernd<br>
<br>
<br>
_______________________________________________<br>
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org<br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</div>
</span></font></div>
</body>
</html>