static*/
| 254 | } |
| 255 | |
| 256 | /*static*/ void Memory::dump_basic_pool_stats() { |
| 257 | |
| 258 | size_t heap_free = 0; |
| 259 | uint8_t heap_pct = 0; |
| 260 | if (heap_pool_info.tlsf != nullptr) { |
| 261 | struct tlsf_stats stats; |
| 262 | memset(&stats, 0, sizeof(stats)); |
| 263 | tlsf_walk_pool(tlsf_get_pool(heap_pool_info.tlsf), tlsf_mem_walker, &stats); |
| 264 | heap_free = stats.free_size; |
| 265 | heap_pct = (uint8_t)((double)heap_free / (double)heap_pool_info.buffer_size * 100.0); |
| 266 | } |
| 267 | if (heap_pool_info.last_free == 0) { |
| 268 | heap_pool_info.last_free = heap_free; |
| 269 | } |
| 270 | |
| 271 | size_t psram_free = 0; |
| 272 | uint8_t psram_pct = 0; |
| 273 | if (psram_pool_info.tlsf != nullptr) { |
| 274 | struct tlsf_stats stats; |
| 275 | memset(&stats, 0, sizeof(stats)); |
| 276 | tlsf_walk_pool(tlsf_get_pool(psram_pool_info.tlsf), tlsf_mem_walker, &stats); |
| 277 | psram_free = stats.free_size; |
| 278 | psram_pct = (uint8_t)((double)psram_free / (double)psram_pool_info.buffer_size * 100.0); |
| 279 | } |
| 280 | if (psram_pool_info.last_free == 0) { |
| 281 | psram_pool_info.last_free = psram_free; |
| 282 | } |
| 283 | |
| 284 | size_t altheap_free = 0; |
| 285 | uint8_t altheap_pct = 0; |
| 286 | if (altheap_pool_info.tlsf != nullptr) { |
| 287 | struct tlsf_stats stats; |
| 288 | memset(&stats, 0, sizeof(stats)); |
| 289 | tlsf_walk_pool(tlsf_get_pool(altheap_pool_info.tlsf), tlsf_mem_walker, &stats); |
| 290 | altheap_free = stats.free_size; |
| 291 | altheap_pct = (uint8_t)((double)altheap_free / (double)altheap_pool_info.buffer_size * 100.0); |
| 292 | } |
| 293 | if (altheap_pool_info.last_free == 0) { |
| 294 | altheap_pool_info.last_free = altheap_free; |
| 295 | } |
| 296 | |
| 297 | VERBOSEF("heap_pool: %u (%u%%) [%d] psram_pool: %u (%u%%) [%d] alt_pool: %u (%u%%) [%d]", heap_free, heap_pct, heap_free - heap_pool_info.last_free, psram_free, psram_pct, psram_free - psram_pool_info.last_free, altheap_free, altheap_pct, altheap_free - altheap_pool_info.last_free); |
| 298 | |
| 299 | heap_pool_info.last_free = heap_free; |
| 300 | psram_pool_info.last_free = psram_free; |
| 301 | altheap_pool_info.last_free = altheap_free; |
| 302 | } |
| 303 | |
| 304 | /*static*/ void Memory::dump_allocator_stats(Memory::allocator_info& allocator_info, const char* name /*= ""*/) { |
| 305 | HEADF(LOG_TRACE, "%sAllocator Stats", name); |
nothing calls this directly
no test coverage detected