Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?
On Sat, 16 Oct 2021 18:16:57 -0400, Travis Siegel via fpc-pascal wrote: > >On 10/16/2021 6:06 PM, Bo Berglund via fpc-pascal wrote: >> Meanwhile the strace outputs stuff like this to the screen: >> strace: Process 6360 attached >> strace: Process 6361 attached >> strace: Process 6362 attached >> strace: Process 6363 attached >> strace: Process 6364 attached >> strace: Process 6365 attached >> strace: Process 6366 attached >> strace: Process 6367 attached >> strace: Process 6368 attached >> strace: Process 6369 attached >> strace: Process 6370 attached >> strace: Process 6371 attached >> strace: Process 6372 attached >> >> I don't understand what this means either >> >It looks like your application is spawning additional processes. If it's >supposed to do that, then all is well. If it isn't supposed to do that >when it's idling, then you have some troubleshooting to do. :) I found a howto-page for strace so I could modify the call to have strace produce a summary after running for the set time (3 seconds here). Easier read but does not give me much to work with. timeout --signal=2 3s strace -f -c -p 488 -o tracelog2.log % time seconds usecs/call callserrors syscall -- --- --- - - 46.470.348353 414 841 nanosleep 27.670.207437 1728612 _newselect 16.170.121220 211 57277 futex 2.540.019020 89 213 munmap 1.770.013281 62 213 mmap2 1.630.012250 43 284 284 ioctl 0.730.005485 7771 madvise 0.550.004137 29 142 gettimeofday 0.530.003958 27 142 clock_gettime 0.510.003858 5471 rt_sigprocmask 0.370.002748 3871 clone 0.360.002688 3771 sched_setscheduler 0.310.002315 3271 set_robust_list 0.300.002262 3171 ugetrlimit 0.070.000548 182 3 1 restart_syscall -- --- --- - - 100.000.749560 2848 362 total I don't really see how this helps either, though As a reminder here is the main application's loop: While not (bSTerm or bSInt or bsHup) do begin //Here is where the server runs as defined elsewhere //Eternal loop to wait for system messages Sleep(5); //To not hog the CPU CheckSynchronize(); //No timeout here since sleep is used //CheckSynchronize(5); //Timeout here instead of using sleep if CheckRestartReq then begin Debug_Writeln('Restart timeout reached - exiting'); FLogServ.StdLog('Restart timeout reached - exiting'); break; //FServerStartTick := GetTickCount64; //Reset timeout for now end; end; And CheckRestartReq implementation: Note that FRemoteTaskServer.AutoRestartInterval is 0 here. So the function CheckRestartReq should always return immediately with a false result. function CheckRestartReq: boolean; var NextStart: TDateTime; begin Result := false; if FRemoteTaskServer.AutoRestartInterval < 120 then exit; //Not configured for automatic restart (min time 2 min) if (GetTickCount64 - FServerStartTick) < (FRemoteTaskServer.AutoRestartInterval * 1000) then exit; //Not reached set restart time yet if FRemoteTaskServer.TaskRunning then exit; //Cannot restart when task is running if FSuperStingSocketServer.ClientCount > 0 then exit; //Cannot restart when client connected NextStart := FRemoteTaskServer.NextTaskStartTime; //Get next time a task will start if NextStart = 0 then //No task scheduled to start so OK to restart server begin Result := true; exit; end; if (NextStart - Now) > (2.0 / 60 / 24) then Result := true; // More than 2 minutes until next task start, so OK to exit end; -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?
On 10/16/2021 6:06 PM, Bo Berglund via fpc-pascal wrote: Meanwhile the strace outputs stuff like this to the screen: strace: Process 6360 attached strace: Process 6361 attached strace: Process 6362 attached strace: Process 6363 attached strace: Process 6364 attached strace: Process 6365 attached strace: Process 6366 attached strace: Process 6367 attached strace: Process 6368 attached strace: Process 6369 attached strace: Process 6370 attached strace: Process 6371 attached strace: Process 6372 attached I don't understand what this means either It looks like your application is spawning additional processes. If it's supposed to do that, then all is well. If it isn't supposed to do that when it's idling, then you have some troubleshooting to do. :) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?
On Fri, 8 Oct 2021 00:12:50 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: >> No matter how long I wait it is now stuck at that double value. >> >> So clearly something must be left behind after the task has finished... >> >> The question is: how to find what is still using CPU? > >Run the process under strace: >strace -f -p PID -o log1.txt >with PID the process ID. > >You will see what system calls are executed. Do this when the load is 4% and >when it's 8%, maybe this will tell you something. > Sorry for not getting back until now, but I have been dealing with Linux system upgrades the whole week... So I tried this at an idle time after start on the test system when nothing has happened and top shows 4% CPU usage. PID of the application is 488. strace -f -p 488 -o tracelog1.log It resulted in a massive tracelog1.log logfile with stuff like this (cut at random iside the file): 488 <... nanosleep resumed> 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 533 <... nanosleep resumed> 0x76212bb0) = 0 533 nanosleep({tv_sec=0, tv_nsec=1000}, 488 <... nanosleep resumed> 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 533 <... nanosleep resumed> 0x76212bb0) = 0 533 nanosleep({tv_sec=0, tv_nsec=1000}, 488 <... nanosleep resumed> 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 533 <... nanosleep resumed> 0x76212bb0) = 0 533 nanosleep({tv_sec=0, tv_nsec=1000}, 488 <... nanosleep resumed> 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 0x7ee339f0) = 0 488 nanosleep({tv_sec=0, tv_nsec=500}, 6063 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) 6063 futex(0x76f6fb98, FUTEX_WAKE_PRIVATE, 1) = 0 6063 mmap2(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x75e0b000 6063 futex(0x75e0b048, FUTEX_WAIT_PRIVATE, 0, NULL 533 <... nanosleep resumed> 0x76212bb0) = 0 533 nanosleep({tv_sec=0, tv_nsec=1000}, 488 <... nanosleep resumed> 0x7ee339f0) = 0 488 clone( 6064 set_robust_list(0x75aff4b0, 12) = 0 6064 futex(0x75aff654, FUTEX_WAIT_PRIVATE, 2, NULL 488 <... clone resumed> child_stack=0x75afef78, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CL$ 488 sched_setscheduler(6064, SCHED_OTHER, [0]) = 0 488 futex(0x75aff654, FUTEX_WAKE_PRIVATE, 1 6064 <... futex resumed> ) = 0 488 <... futex resumed> ) = 1 6064 futex(0x75aff654, FUTEX_WAKE_PRIVATE, 1 488 clock_gettime(CLOCK_MONOTONIC_RAW, 6064 <... futex resumed> ) = 0 488 <... clock_gettime resumed> {tv_sec=228720, tv_nsec=105079052}) = 0 which I really understand nothing of... Running for some 5-10 secnds resulted in a logfile of 2 MB size Meanwhile the strace outputs stuff like this to the screen: strace: Process 6360 attached strace: Process 6361 attached strace: Process 6362 attached strace: Process 6363 attached strace: Process 6364 attached strace: Process 6365 attached strace: Process 6366 attached strace: Process 6367 attached strace: Process 6368 attached strace: Process 6369 attached strace: Process 6370 attached strace: Process 6371 attached strace: Process 6372 attached I don't understand what this means either -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
If you are running x64-86 Linux, would like to get my code you can join my Discord channel at the link below. Windows and Mac users will need to have cmake and the ability to build with it, but they're invited as well. https://discord.gg/NuTDatAz I am making a lot of changes, so I don't want to create a public git repo just yet. Currently I am working on writing rope and water physics demos, and will probably refactor everything before I do my first git check in. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
Not entirely, a link to the wrappers is missing, unless I overlooked it. A link to repository for a complete demo would be useful. Darius Sent from my iPhone > On 16 Oct 2021, at 12:59, wkitty42--- via fpc-pascal > wrote: > > > ummm... the source code is on the linked page ;) > >> On 10/16/21 2:58 AM, Darius Blaszyk via fpc-pascal wrote: >> Can you put the link up to the source code please? On 16 Oct 2021, at 00:27, Anthony Walter via fpc-pascal wrote: >>> [...] >>> https://www.getlazarus.org/videos/physics/collisions/ >>> >>> Source code for the test scene is included on that page. [...] > > > -- > NOTE: No off-list assistance is given without prior approval. > *Please keep mailing list traffic on the list where it belongs!* > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
ummm... the source code is on the linked page ;) On 10/16/21 2:58 AM, Darius Blaszyk via fpc-pascal wrote: Can you put the link up to the source code please? On 16 Oct 2021, at 00:27, Anthony Walter via fpc-pascal wrote: [...] https://www.getlazarus.org/videos/physics/collisions/ Source code for the test scene is included on that page. [...] -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!* ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TFieldType declaration change in fixes2_2 branch
I thought that a fixes branch was only for bug fixes and not for issuing non-backwards compatible changes. However, TFieldType in db.pas now has 6 extra elements.The result is that IBX no longer compiles with the fixes_2_2 branch. I have also heard the same for zeoslib.Is the rollout of this patch to fixes_2_2 a mistake, or is there a good reason for rolling out a change that breaks other packages?Tony WhymanMWA Software___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
Hi Anthony, Can you put the link up to the source code please? Rgds, Darius Sent from my iPhone > On 16 Oct 2021, at 00:27, Anthony Walter via fpc-pascal > wrote: > > > I've been working on writing Pascal bindings a friendly object orient > interface to a few open source projects. I have put together Chipmunk2D, > NanoVG, MiniMP3, and SDL2 for rendering nice real time platform independent > programs where fast logic can be easily controlled with physics or fast > graphics can easily be rendered. > > If you are interested in hearing more, I've put up a quick and dirty video of > one of my test scene that precisely detects points of contact and the forces > behind them at the page below. > > https://www.getlazarus.org/videos/physics/collisions/ > > Source code for the test scene is included on that page. If you want to help, > I need to bounce ideas off people as well as test on Raspberry Pi, Mac, and > Windows. Message me and maybe we can try to meet on a Discord channel. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal