Skip to content

๐Ÿ‡ฌ๐Ÿ‡ง English: Modular resource monitor for ESP32 with task, memory, and timer diagnostics. Designed for ESP-IDF. ๐Ÿ‡ท๐Ÿ‡ด Romรขnฤƒ: Monitor modular de resurse pentru ESP32 cu diagnosticare de taskuri, memorie ศ™i timere. Compatibil ESP-IDF.

License

Notifications You must be signed in to change notification settings

florinbaciuu/ESP32_Resource_Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  ESP32_Resource_Monitor

PlatformIO ESP-IDF

Advanced resource monitor for ESP32
๐Ÿ“Ÿ Tracks tasks, memory, PSRAM, heap, timers, and more, with detailed configuration options via Kconfig.
โœ๏ธ Created by Baciu Aurel Florin (a.k.a. The Lightbringer)


โœจ Features

  • โœ… CPU usage per task (load, stack usage, core ID, priority)
  • โœ… Advanced heap and PSRAM dump
  • โœ… Segmented stats (DMA, RTCRAM, 8bit/32bit, etc.)
  • โœ… Supports ESP timer dump
  • โœ… Optional: full memory heap dump (heap_caps_dump())
  • โœ… Debug mode with timestamp and benchmarking
  • โœ… Full Kconfig configuration
  • โœ… Runs using:
    • Dedicated task (with notify)
    • Directly from esp_timer (with or without task)
    • Pure FreeRTOS mode (vTaskDelayUntil)
  • โœ… ESP-IDF v5.x+ compatible

๐Ÿ“‚ Structure

ESP32S3_Resource_Monitor/
โ”œโ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ Kconfig
โ”œโ”€โ”€ include/
โ”‚   โ””โ”€โ”€ ResourceMonitor.h
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ ResourceMonitor.c
โ””โ”€โ”€ README.md

โš™๏ธ Kconfig Options

Component has a dedicated menu:

Component config  --->
  ESP32S3 Resource Monitor Configuration  --->
    [*] Enable Resource Monitor
    [*] Use Kconfig for configuration
        (4)  Dump interval (seconds)
        (40) Max number of monitored tasks
        [*] Include timestamp in logs
        [*] Enable task monitoring output
        [*] Enable memory usage dump
        [*] Use printf instead of ESP_LOGI for memory info
        [ ] Enable full heap memory dump
        [*] Enable ESP timer diagnostics
        [*] Use ESP timer for triggering resource monitor
        [ ] Run monitor directly inside ESP timer

๐Ÿ› ๏ธ Usage

1. Include the component:

In your CMakeLists.txt:

set(EXTRA_COMPONENT_DIRS "<path>/ESP32S3_Resource_Monitor")

2. Use in your code:

#include "ResourceMonitor.h"

void app_main() {
    start_resource_monitor();  // Start the monitor
}

๐Ÿงช Sample Output

๐Ÿ“Œ Real console output:

I (652) MY-RESOURCE-MONITOR (BY Florin Baciu): ESPResourceMonitor v1.0.0 initialized
I (5647) MY-RESOURCE-MONITOR (BY Florin Baciu): Timestamp: [1970-01-01 02:38:50]
I (5647) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Task Dump Start-----------------

Load    Stack   State   CoreID  PRIO    Name
0.01    1744    Running 1       3       [RESMONITOR(R)   ] 
98.56   2484    Ready   0       0       [IDLE0           ] 
92.65   2492    Ready   1       0       [IDLE1           ] 
0.21    2408    Blocked 1       24      [LVGL Tick Task  ] 
0.05    2196    Suspend 0       19      [ipc0            ] 
0.01    1996    Suspend 1       19      [v_check_0_pin_s ] 
0.08    6704    Suspend 1/2     3       [swdraw          ] 
0.57    6648    Suspend 1/2     3       [swdraw          ] 
0.00    3860    Suspend 0       22      [esp_timer       ] 
7.00    3616    Suspend 1       22      [LVGL Main Task  ] 
0.05    2332    Suspend 1       24      [ipc1            ] 

I (5651) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Task Dump End-------------------
I (5651) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Memory Info Start---------------

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• MEMORY STATS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘   Segment     โ”‚    Total     โ”‚    Used     โ”‚   Free      โ”‚ Utilizare %   โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ RAM          โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RAM-DMA      โ”‚   266.5 KB  โ”‚    73.4 KB โ”‚   193.1 KB โ”‚    27.56 %     โ•‘
โ•‘ RAM 8 bit    โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RAM 32 bit   โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RTC RAM      โ”‚     7.7 KB  โ”‚     0.4 KB โ”‚     7.3 KB โ”‚     4.97 %     โ•‘
โ•‘ PSRAM        โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•‘ PSRAM 8 bit  โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•‘ PSRAM 32 bit โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•


I (5656) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Memory Info End-----------------
I (5656) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------ESP Timer Dump Start------------

Timer stats:
Name                  Period      Alarm         Times_armed   Times_trigg   Times_skip    Cb_exec_time
res_mon_timer         5000000     10159844      1             1             0             10

I (5657) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------ESP Timer Dump End--------------
I (5658) RESMON_BENCH: resource_monitor_callback() execution time: 10648 ยตs (10.65 ms)
I (10647) RESMON_BENCH: ฮ” timp รฎntre apeluri: 5000000 ยตs (5.00 sec)
I (10647) MY-RESOURCE-MONITOR (BY Florin Baciu): Timestamp: [1970-01-01 02:38:55]

๐Ÿงฉ Extensibility

Callback functions are modular:

  • task_monitor_cb()
  • memory_monitor_cb()
  • esp_timers_monitor_cb()
  • memory_dump_cb()

You can invoke them independently or integrate into custom diagnostics.


๐Ÿ” License

Apache 2.0 โ€” use freely, contribute confidently.


๐Ÿค Contribute

Pull requests, feedback, and enhancements are welcome!
Please follow the existing code style and provide comments.


๐Ÿ“ง Contact

๐Ÿ“ฎ Author: Baciu Aurel Florin
โœ‰๏ธ Email: baciuaurelflorin@gmail.com


๐Ÿง™โ€โ™‚๏ธ The Lightbringer Rulez

This isn't just a library. It's your eyes inside the system.
The heresy of idle tasks shall burn in the fire of RAM.


๐Ÿง  ESP32_Resource_Monitor (รฎn romรขnฤƒ)

PlatformIO ESP-IDF

Monitor avansat de resurse pentru ESP32
๐Ÿ“Ÿ Monitorizeazฤƒ taskuri, memorie, PSRAM, heap, timere ศ™i mai mult, cu opศ›iuni detaliate de configurare via Kconfig.
โœ๏ธ Creat de Baciu Aurel Florin (a.k.a. The Lightbringer)


โœจ Caracteristici

  • โœ… Monitorizare CPU per task (load, stack usage, core ID, prioritate)
  • โœ… Dump avansat de heap ศ™i PSRAM
  • โœ… Statistici segmentate (DMA, RTCRAM, 8bit/32bit, etc.)
  • โœ… Suport pentru ESP timer dump
  • โœ… Opศ›ional: memory heap dump complet (heap_caps_dump())
  • โœ… Mod debug cu timestamp ศ™i benchmark
  • โœ… Kconfig complet pentru configurare uศ™oarฤƒ
  • โœ… Suport pentru rulare รฎn:
    • Task dedicat (cu notificare)
    • Direct รฎn esp_timer (cu sau fฤƒrฤƒ task)
    • Mod FreeRTOS pur (vTaskDelayUntil)
  • โœ… Compatibil ESP-IDF v5.x+

๐Ÿ“‚ Structurฤƒ

ESP32S3_Resource_Monitor/
โ”œโ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ Kconfig
โ”œโ”€โ”€ include/
โ”‚   โ””โ”€โ”€ ResourceMonitor.h
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ ResourceMonitor.c
โ””โ”€โ”€ README.md

โš™๏ธ Configurare Kconfig

Librฤƒria vine cu un meniu Kconfig dedicat:

Component config  --->
  ESP32S3 Resource Monitor Configuration  --->
    [*] Enable Resource Monitor
    [*] Use Kconfig for configuration
        (4)  Dump interval (seconds)
        (40) Max number of monitored tasks
        [*] Include timestamp in logs
        [*] Enable task monitoring output
        [*] Enable memory usage dump
        [*] Use printf instead of ESP_LOGI for memory info
        [ ] Enable full heap memory dump
        [*] Enable ESP timer diagnostics
        [*] Use ESP timer for triggering resource monitor
        [ ] Run monitor directly inside ESP timer

๐Ÿ› ๏ธ Utilizare

1. Include componenta รฎn proiectul tฤƒu:

Adaugฤƒ รฎn CMakeLists.txt:

set(EXTRA_COMPONENT_DIRS "<cale>/ESP32S3_Resource_Monitor")

2. Include header-ul รฎn codul tฤƒu:

#include "ResourceMonitor.h"

void app_main() {
    start_resource_monitor();  // Porneศ™te monitorul
}

๐Ÿงช Exemplu de output

๐Ÿ“Œ Output Real:

I (652) MY-RESOURCE-MONITOR (BY Florin Baciu): ESPResourceMonitor v1.0.0 initialized
I (5647) MY-RESOURCE-MONITOR (BY Florin Baciu): Timestamp: [1970-01-01 02:38:50]
I (5647) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Task Dump Start-----------------

Load    Stack   State   CoreID  PRIO    Name
0.01    1744    Running 1       3       [RESMONITOR(R)   ] 
98.56   2484    Ready   0       0       [IDLE0           ] 
92.65   2492    Ready   1       0       [IDLE1           ] 
0.21    2408    Blocked 1       24      [LVGL Tick Task  ] 
0.05    2196    Suspend 0       19      [ipc0            ] 
0.01    1996    Suspend 1       19      [v_check_0_pin_s ] 
0.08    6704    Suspend 1/2     3       [swdraw          ] 
0.57    6648    Suspend 1/2     3       [swdraw          ] 
0.00    3860    Suspend 0       22      [esp_timer       ] 
7.00    3616    Suspend 1       22      [LVGL Main Task  ] 
0.05    2332    Suspend 1       24      [ipc1            ] 

I (5651) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Task Dump End-------------------
I (5651) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Memory Info Start---------------

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• MEMORY STATS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘   Segment     โ”‚    Total     โ”‚    Used     โ”‚   Free      โ”‚ Utilizare %   โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ RAM          โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RAM-DMA      โ”‚   266.5 KB  โ”‚    73.4 KB โ”‚   193.1 KB โ”‚    27.56 %     โ•‘
โ•‘ RAM 8 bit    โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RAM 32 bit   โ”‚   274.2 KB  โ”‚    73.8 KB โ”‚   200.4 KB โ”‚    26.93 %     โ•‘
โ•‘ RTC RAM      โ”‚     7.7 KB  โ”‚     0.4 KB โ”‚     7.3 KB โ”‚     4.97 %     โ•‘
โ•‘ PSRAM        โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•‘ PSRAM 8 bit  โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•‘ PSRAM 32 bit โ”‚  7104.0 KB  โ”‚  1363.1 KB โ”‚  5740.9 KB โ”‚    19.19 %     โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•


I (5656) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------Memory Info End-----------------
I (5656) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------ESP Timer Dump Start------------

Timer stats:
Name                  Period      Alarm         Times_armed   Times_trigg   Times_skip    Cb_exec_time
res_mon_timer         5000000     10159844      1             1             0             10

I (5657) MY-RESOURCE-MONITOR (BY Florin Baciu): -----------------ESP Timer Dump End--------------
I (5658) RESMON_BENCH: resource_monitor_callback() execution time: 10648 ยตs (10.65 ms)
I (10647) RESMON_BENCH: ฮ” timp รฎntre apeluri: 5000000 ยตs (5.00 sec)
I (10647) MY-RESOURCE-MONITOR (BY Florin Baciu): Timestamp: [1970-01-01 02:38:55]

๐Ÿงฉ Extensibilitate

Toate callback-urile de monitorizare sunt separate:

  • task_monitor_cb()
  • memory_monitor_cb()
  • esp_timers_monitor_cb()
  • memory_dump_cb()

Le poศ›i apela individual sau le poศ›i integra รฎntr-un sistem propriu de diagnostic.


๐Ÿ” Licenศ›ฤƒ

Apache 2.0 โ€” foloseศ™te liber, contribuie cu รฎncredere.


๐Ÿค Contribuie

Pull requests, idei ศ™i รฎmbunฤƒtฤƒศ›iri sunt binevenite!
Te rog adaugฤƒ comentarii clare ศ™i pฤƒstreazฤƒ stilul de cod existent.


๐Ÿ“ง Contact

๐Ÿ“ฎ Autor: Baciu Aurel Florin
โœ‰๏ธ Email: baciuaurelflorin@gmail.com


๐Ÿง™โ€โ™‚๏ธ The Lightbringer Rulez

Aceasta nu este doar o librฤƒrie. Este o extensie a ochilor tฤƒi รฎn sistem.
Eresul taskurilor inutile va fi ars รฎn focul RAM-ului.


About

๐Ÿ‡ฌ๐Ÿ‡ง English: Modular resource monitor for ESP32 with task, memory, and timer diagnostics. Designed for ESP-IDF. ๐Ÿ‡ท๐Ÿ‡ด Romรขnฤƒ: Monitor modular de resurse pentru ESP32 cu diagnosticare de taskuri, memorie ศ™i timere. Compatibil ESP-IDF.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published