We're running Codesys on it's own core in a multi-core CPU.
We would like to present the Codesys CPU load in a HMI application running on another core.
Which Codesys library/function can be used for getting the CPU load percentage?
I messed around and tried some different functions but never got it to work, hopefully you can provide me with the right answer.
Regards
Kim Hansen
Beijer Electronics Automation
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm testing the call udiProzessorLoad:=SchedGetProcessorLoad(Result); but the CPU load I get is very different from "htop" value (In codesys I read 8, in htop I get less than 4%).. Why?
SchedGetProcessorload only gives the load of Realtime IEC Tasks. As the rest are background jobs with few to none realtime constraints. You can imagine, that with 100% background load, the system is still responsive. But when you have 100% load in realtime taks, your CPU is stuck, and no communication possible anymore. That's the reason why CODESYS monitors this load.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We're running Codesys on it's own core in a multi-core CPU.
We would like to present the Codesys CPU load in a HMI application running on another core.
Which Codesys library/function can be used for getting the CPU load percentage?
I messed around and tried some different functions but never got it to work, hopefully you can provide me with the right answer.
Regards
Kim Hansen
Beijer Electronics Automation
Hi Kim,
udiProzessorLoad:=SchedGetProcessorLoad(Result);
BR
Edwin
Been searching a lot for this one. Thanks for the info.
I'm testing the call udiProzessorLoad:=SchedGetProcessorLoad(Result); but the CPU load I get is very different from "htop" value (In codesys I read 8, in htop I get less than 4%).. Why?
Last edit: fleaplc 2020-08-29
SchedGetProcessorload only gives the load of Realtime IEC Tasks. As the rest are background jobs with few to none realtime constraints. You can imagine, that with 100% background load, the system is still responsive. But when you have 100% load in realtime taks, your CPU is stuck, and no communication possible anymore. That's the reason why CODESYS monitors this load.
Hi Ingo, thanks for clarification. Do you know some function to read the "total" CPU load? (to get same value as in htop?)
Depending on the PLC, SysCpuMulticore might give you that info. But I am
not at the PC to check the exact interface.