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
Functions to display current tasks and memory usage
Re: Functions to display current tasks and memory usage
vTaskList
This function need the following two options enabled:
CONFIG_FREERTOS_USE_TRACE_FACILITY
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
This function need the following two options enabled:
CONFIG_FREERTOS_USE_TRACE_FACILITY
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
Re: Functions to display current tasks and memory usage
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?
Re: Functions to display current tasks and memory usage
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.
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
Re: Functions to display current tasks 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
Re: Functions to display current tasks and memory usage
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
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
Re: Functions to display current tasks and memory usage
Hi,
Kindly help please with nice pretty output of CPU stats.
I need to know CPU IDLE for both cpu0 and cpu1
Thanks,
Naeem
Kindly help please with nice pretty output of CPU stats.
I need to know CPU IDLE for both cpu0 and cpu1
Thanks,
Naeem
Re: Functions to display current tasks and memory usage
Hi
Can someone check my code for deep sleep. I am unable to get it below 9mA. Please help
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 3 /* Time ESP32 will go to sleep (in seconds) */
RTC_DATA_ATTR int bootCount = 0;
int GREEN_LED_PIN = 25;
int YELLOW_LED_PIN = 26;
void setup(){
pinMode(GREEN_LED_PIN,OUTPUT);
pinMode(YELLOW_LED_PIN,OUTPUT);
delay(500);
if(bootCount == 0) //Run this only the first time
{
digitalWrite(YELLOW_LED_PIN,HIGH);
bootCount = bootCount+1;
}else
{
digitalWrite(GREEN_LED_PIN,HIGH);
}
delay(3000);
digitalWrite(GREEN_LED_PIN,LOW);
digitalWrite(YELLOW_LED_PIN,LOW);
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_deep_sleep_start();
}
void loop(){
}
Can someone check my code for deep sleep. I am unable to get it below 9mA. Please help
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 3 /* Time ESP32 will go to sleep (in seconds) */
RTC_DATA_ATTR int bootCount = 0;
int GREEN_LED_PIN = 25;
int YELLOW_LED_PIN = 26;
void setup(){
pinMode(GREEN_LED_PIN,OUTPUT);
pinMode(YELLOW_LED_PIN,OUTPUT);
delay(500);
if(bootCount == 0) //Run this only the first time
{
digitalWrite(YELLOW_LED_PIN,HIGH);
bootCount = bootCount+1;
}else
{
digitalWrite(GREEN_LED_PIN,HIGH);
}
delay(3000);
digitalWrite(GREEN_LED_PIN,LOW);
digitalWrite(YELLOW_LED_PIN,LOW);
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_deep_sleep_start();
}
void loop(){
}
Who is online
Users browsing this forum: Michaelboeding and 101 guests