I am not getting good CPU thread/task utlization in percentage.
static char __stats_buffer[1024];
vTaskGetRunTimeStats(__stats_buffer);
printf("%s\n", __stats_buffer);
vTaskList(__stats_buffer);
printf( "%s\n", __stats_buffer);
Any thing wrong here.
How to get "CPU load" and "Memory Usage"
Re: How to get "CPU load" and "Memory Usage"
Your interpretation of what you see, perhaps?snahmad75 wrote:Any thing wrong here.
I use that routine. It seems to provide useful info as long as the uptime is not too long.
John A
Re: How to get "CPU load" and "Memory Usage"
Just FYI....
http://esp32.info/docs/esp_idf/html/d3/ ... Stats.htmlNOTE 1: This function will disable interrupts for its duration. It is not intended for normal application runtime use but as a debug aid.
Re: How to get "CPU load" and "Memory Usage"
ok, I see . Thanks for information. yes it was slowly down my application processing. good to know.
I am planning to use visual debugger with visual studio. I hope that do not disable interrupt during get CPU usage.
Is get remaining internal/external ram esp32 function also do same disable interrupt?
I am planning to use visual debugger with visual studio. I hope that do not disable interrupt during get CPU usage.
Is get remaining internal/external ram esp32 function also do same disable interrupt?
Re: How to get "CPU load" and "Memory Usage"
vTaskGetRunTimeStats output looks wrong (after running for 6 hours):
e.g.
IDLE0 3975459304 241%
IDLE1 819548835 49%
tiT 95644729 5%
Tmr Svc 49 <1%
....
How can IDLE0 reach 241%?
e.g.
IDLE0 3975459304 241%
IDLE1 819548835 49%
tiT 95644729 5%
Tmr Svc 49 <1%
....
How can IDLE0 reach 241%?
Re: How to get "CPU load" and "Memory Usage"
axellin wrote:vTaskGetRunTimeStats output looks wrong (after running for 6 hours):
e.g.
IDLE0 3975459304 241%
IDLE1 819548835 49%
tiT 95644729 5%
Tmr Svc 49 <1%
....
How can IDLE0 reach 241%?
I suggest you call either "esp_timer_get_time" or "xTaskGetTickCount()" to get the total system uptime and compare against the runtime numbers for each task. You will get a different result. Not sure why the call to vTaskGetRunTimeStats gets it wrong after running for a while. The source is in the IDF but I never spent the time to investigate.It seems to provide useful info as long as the uptime is not too long.
Also... eventually getting the system uptime will give incorrect results as well. Bottom line... it appears that counters roll over and the times no longer do the trick. I imagine that it could be fixable with a little work. Or you could simply do your profiling closer to the boot time.
John A
Re: How to get "CPU load" and "Memory Usage"
Hi,
I tried vTaskList. It does not shows cpu usage in percentage.
printf( "Task Name\tStatus\tPrio\tHWM\tTask\tAffinity\n");
char stats_buffer[1024];
vTaskList(stats_buffer);
printf("%s\n", stats_buffer);
Thanks,
Naeem
I tried vTaskList. It does not shows cpu usage in percentage.
printf( "Task Name\tStatus\tPrio\tHWM\tTask\tAffinity\n");
char stats_buffer[1024];
vTaskList(stats_buffer);
printf("%s\n", stats_buffer);
Thanks,
Naeem
Who is online
Users browsing this forum: Google [Bot] and 24 guests