Can I get current CPU load and memory usage

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mhc994
Posts: 1
Joined: Tue Feb 05, 2019 2:28 am

Can I get current CPU load and memory usage

Post by mhc994 » Tue Feb 05, 2019 2:38 am

I work on an ESP32 board. Micropython is so cool as multi-thread is supported. But I wonder if there is a way to check the CPU load and the memory usage when I run my script.
Sorry if this question is too stupid...

ThomasChr
Posts: 121
Joined: Sat Nov 25, 2017 7:50 am

Re: Can I get current CPU load and memory usage

Post by ThomasChr » Tue Feb 05, 2019 11:07 am

You can get all kinds of memory details with the gc module.
Getting the CPU Usage makes no sense because in the uc world a CPU is running "all the time" (this is also true for modern PCs, but the OS sometimes runs a code snippet called "idle loop" which lets the CPU spin without doing anything, that's how the sheduler knows if the CPU is running a program (running) or running the idle loop (doing nothing usefull and ready to do real world)).

Post Reply