How to get CPU load approximate value on Micropython ?
How to get CPU load approximate value on Micropython ?
How to get CPU load approximate value on Micropython ?
Re: How to get CPU load approximate value on Micropython ?
Excluding the UNIX port, I am not quite sure that one can get such a figure. In many cases micropython is running on bare metal without any os, so the "load" would be 100%...
Re: How to get CPU load approximate value on Micropython ?
I tried a short explaination here: viewtopic.php?f=2&t=5922
Re: How to get CPU load approximate value on Micropython ?
ThomasChr and fstengel are correct in saying that on the vanilla microcontroller ports the load is 100% because MicroPython is always running something. For example it might be waiting for input at the REPL prompt or (after receiving input) taking the necessary steps to lex, compile, and then run the bytecode for the requested actions.
However hypothetically if you had an appropriate system (such as running MicroPython on top of a scheduler like FreeRTOS) and you called appropriate "blocking" code (e.g. maybe you would make it so that utime.sleep() delays using vTaskDelay()) then other 'tasks' might be able to execute when MicroPython is busy. In that case you could use any of a number of methods to determine the duty cycle that MicroPython is using.
However hypothetically if you had an appropriate system (such as running MicroPython on top of a scheduler like FreeRTOS) and you called appropriate "blocking" code (e.g. maybe you would make it so that utime.sleep() delays using vTaskDelay()) then other 'tasks' might be able to execute when MicroPython is busy. In that case you could use any of a number of methods to determine the duty cycle that MicroPython is using.