Application Memory Statistic (Alpha)#
The service systematically collects heap and stack usage data from active threads across various configurations involving FreeRTOS, MicriumOS, and different toolchains such as GCC and IAR. This critical information is then relayed to the Real-Time Transfer (RTT) console. To ensure accurate reporting, proper RTT setup is essential. The component includes a warning mechanism that provides hints about missing or incorrect configurations.
Within the component configuration, you can set the service thread parameters, the update period time, the maximum count of trackable threads, and enable heap usage statistics. A common scenario involves increasing the measurable thread stack size and the application heap size before beginning testing.
Based on the measurement results, adjustments can be made to the appropriate thread's stack and the application heap size. Stack size is calculated using the highest watermarks, and the last result always displays the maximum values.
The following RTT log demonstrates the component's operation:
[APP_OS_STAT][AppMain] Used/Tot: 584/1024 (58%)
[APP_OS_STAT][Ping] Used/Tot: 232/1024 (23%)
[APP_OS_STAT][WisunLedTask] Used/Tot: 192/320 (64%)
[APP_OS_STAT][AppOsStatThread] Used/Tot: 728/1024 (72%)
[APP_OS_STAT][Wi-SUN Event Task] Used/Tot: 500/2000 (25%)
[APP_OS_STAT][Wi-SUN Task] Used/Tot: 1164/2000 (58%)
[APP_OS_STAT][CoAP-Notification-Service] Used/Tot: 208/1024 (20%)
[APP_OS_STAT][CoAP-RHND-Service] Used/Tot: 240/1024 (24%)
[APP_OS_STAT][CLI instance vcom] Used/Tot: 340/1600 (21%)
[APP_OS_STAT][Kernel's Stat Task] Used/Tot: 188/1024 (18%)
[APP_OS_STAT][heap] addr 0x2000BF80 Used/Tot: 65560/475264 (13%)
Modules#
#
Initialize App OS statistic service.
Register thread to track.
Remove thread from list.
app_os_stat_init#
void app_os_stat_init (void )
Initialize App OS statistic service.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Init thread and staistic storage
app_os_stat_register_thread#
sl_status_t app_os_stat_register_thread (const osThreadId_t thr_id)
Register thread to track.
Type | Direction | Argument Name | Description |
---|---|---|---|
const osThreadId_t | [in] | thr_id | Thread ID |
Thread stack usage is tracked Returns
sl_status_t SL_STATUS_OK on success, SL_STATUS_FAIL on error
app_os_stat_remove_thread#
sl_status_t app_os_stat_remove_thread (const osThreadId_t thr_id)
Remove thread from list.
Type | Direction | Argument Name | Description |
---|---|---|---|
const osThreadId_t | [in] | thr_id | Thread ID |
Remove thread from tracked thread list Returns
sl_status_t SL_STATUS_OK on success, SL_STATUS_FAIL on error