Folks,
Is there an "official" way to read the approximate CPU load e.g. how much time is spent in IDLE vs other tasks? I'd ideally need this per core, tips on how to achieve that would be appreciated.
Thanks
Approximate reasonably CPU load per core?
Re: Approximate reasonably CPU load per core?
With RTOS stats, you can see task usage of all tasks of both cpus (including IDLEs)mharizanov wrote: ↑Thu Nov 21, 2019 11:08 amFolks,
Is there an "official" way to read the approximate CPU load e.g. how much time is spent in IDLE vs other tasks? I'd ideally need this per core, tips on how to achieve that would be appreciated.
Thanks
https://www.freertos.org/rtos-run-time-stats.html
Re: Approximate reasonably CPU load per core?
Note: The above link gives you a total count. You may also wish to see load over 0.25 seconds. You would have to write that code yourself but its fairly easy to populate an array with task name and last run count from which to perform the delta.
I found that the returned task list would change the order of tasks so I am afraid you will have to hunt your entry if you want to see deltas.
I found that the returned task list would change the order of tasks so I am afraid you will have to hunt your entry if you want to see deltas.
& I also believe that IDF CAN should be fixed.
-
- Posts: 5
- Joined: Tue Dec 15, 2015 8:26 am
Re: Approximate reasonably CPU load per core?
Thanks for the pointers. Looks like with some fiddling, it will work. I'll update the thread.
-
- Posts: 5
- Joined: Tue Dec 15, 2015 8:26 am
Re: Approximate reasonably CPU load per core?
Got it working. Had to enable "Component config > FreeRTOS > Enable FreeRTOS to collect run time stats " in menuconfig (IDF 3.3)
Gives me output like this:
So CPU load per core is 100%-IDLE[0,1]
Thanks!
Gives me output like this:
Code: Select all
main 886790 <1%
IDLE1 146272698 90%
IDLE0 151160911 93%
buzzer_task 153997 <1%
tiT 439292 <1%
mqtt_task 2849535 1%
lvgl_task 14420182 8%
Tmr Svc 76 <1%
rfm69 73008 <1%
ipc0 2973947 1%
esp_timer 70375 <1%
wifi 2703508 1%
ipc1 251647 <1%
eventTask 11000 <1%
gpio_task 807 <1%
So CPU load per core is 100%-IDLE[0,1]
Thanks!
-
- Posts: 5
- Joined: Tue Dec 15, 2015 8:26 am
Re: Approximate reasonably CPU load per core?
Thanks for this, yes, it would make most sense to have "live" data, not accumulated totals since boot. Since my interest is in CPU load, I only care for the delta in IDLE[0,1] task. This makes the code simpler too.PeterR wrote: ↑Thu Nov 21, 2019 1:55 pmNote: The above link gives you a total count. You may also wish to see load over 0.25 seconds. You would have to write that code yourself but its fairly easy to populate an array with task name and last run count from which to perform the delta.
I found that the returned task list would change the order of tasks so I am afraid you will have to hunt your entry if you want to see deltas.
Re: Approximate reasonably CPU load per core?
Cool.
Yes, it works, well sometimes the numbers do not add up to 100% but its good enough.
I have mine also showing load in last 0.25 seconds which helps with bursty activity. Just cannot share.
You will have to go a little native if you want to name std::thread
If you need wrap the constructor and use esp_pthread_set_cfg().
Yes, it works, well sometimes the numbers do not add up to 100% but its good enough.
I have mine also showing load in last 0.25 seconds which helps with bursty activity. Just cannot share.
You will have to go a little native if you want to name std::thread
If you need wrap the constructor and use esp_pthread_set_cfg().
& I also believe that IDF CAN should be fixed.
Who is online
Users browsing this forum: Bing [Bot] and 79 guests