Functions to display current tasks and memory usage

rwel59
Posts: 69
Joined: Thu Oct 12, 2017 3:32 pm

Functions to display current tasks and memory usage

Postby rwel59 » Mon Apr 02, 2018 3:03 am

I thought that I had seen references to a couple of functions but having trouble finding them again (or maybe it was my imagination).

- Is there a function that I can call in code to determine what tasks are currently running, or at least if a specific (named) task is running

- Is there a function that I can monitor in code to track a specific task's memory consumption

ESP_igrr
Posts: 1261
Joined: Tue Dec 01, 2015 8:37 am

Re: Functions to display current tasks and memory usage

Postby ESP_igrr » Mon Apr 02, 2018 3:27 am


rwel59
Posts: 69
Joined: Thu Oct 12, 2017 3:32 pm

Re: Functions to display current tasks and memory usage

Postby rwel59 » Mon Apr 02, 2018 11:44 am

I'm assuming that turning on the trace will impact size (and maybe performance)? Are there any non-debugging facilities available to get this info as part of 'normal' code operations?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Functions to display current tasks and memory usage

Postby kolban » Mon Apr 02, 2018 3:03 pm

If we take a look at the FreeRTOS underlying API called "vTaskList" ... see:

https://www.freertos.org/a00021.html#vTaskList

we see that FreeRTOS itself requires trace enabled.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

snahmad75
Posts: 356
Joined: Wed Jan 24, 2018 6:32 pm

Re: Functions to display current tasks and memory usage

Postby snahmad75 » Wed Dec 05, 2018 7:56 pm

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

User avatar
fly135
Posts: 457
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Functions to display current tasks and memory usage

Postby fly135 » Wed Dec 05, 2018 9:42 pm

snahmad75 wrote:
Wed Dec 05, 2018 7:56 pm
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
https://www.freertos.org/rtos-run-time-stats.html

snahmad75
Posts: 356
Joined: Wed Jan 24, 2018 6:32 pm

Re: Functions to display current tasks and memory usage

Postby snahmad75 » Wed Dec 05, 2018 10:22 pm

Hi,

I did use vTaskGetRunTimeStats() but was not pretty output.

Give me example to show CPU usage per thread with columns and tabular form.


Thanks,
Naeem

Who is online

Users browsing this forum: No registered users and 18 guests