Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By beic
#88039
Bonzo wrote:
Yeah, after more that 300 views already and no one dropped any thoughts or information.


Perhaps most peoples projects are quite small and there is no reason to know the load and like me they are just viewing the this thread out of interest?


Maybe you are right, but imagine for example that you don't have Task Manager > Performance under Windows, Linux or any OS and you can't see CPU load/usage but only RAM?

Now I would need in my monitoring project and I can't find nothing about CPU usage only to get the CPU Speed, now that is a useless information, because you already know that the default is 80MHz and 160MHz.

Kind regards,
Viktor
User avatar
By RichardS
#88040 Yeah I had the same thoughts when looking for the info for the ESP32, which uses FREE RTOS which basically has the functionality, but its not brought out in the Arduino version... however I think if you use the GCC compiler version you can do it...

RichardS
User avatar
By beic
#88050
RichardS wrote:Yeah I had the same thoughts when looking for the info for the ESP32, which uses FREE RTOS which basically has the functionality, but its not brought out in the Arduino version... however I think if you use the GCC compiler version you can do it...
RichardS


Yes, it's really awkward especially for the whole new core for ESP32 for example, and there is also no implementation for the CPU load like
Code: Select allESP.getCpuLoad()
or
Code: Select allESP.getCpuUsage()
.

I saw that you can do some things with the RTOS, but in that case you would need to run separate Task configurations, etc...

I would really like to have some simple Function or even a Library for ESP8266 to be able to get CPU load without running complex tasks, etc...

Kind regards,
Viktor
User avatar
By btidey
#88052 In the Arduino environment the simplistic and not useful answer is that the CPU load is 100%.

After set up the loop() is executed forever; there is no idle task which would be the normal way of characterising CPU load.

A more useful concept in this environment is the average execution time for each iteration of the loop (including background activity) which can be easily measured (e.g micros()). If you then have an idea of what the minimum service time interval required for the loop then you have a measure of how much headroom you have left. For example, if one pass of the loop takes 50mSec on average and you need to ensure the loop is traversed at least twice per second to maintain core functionality then you are effectively at about 10 % capacity.

Of course an average measurement of CPU load does not guarantee safe operation even if it is low. There can be critical latencies that need to be met in a particular application.