feat(heap): Modify heap trace log API
Using ESP_EARLY_LOGx instead of ESP_LOGx.
#include "esp_heap_trace.h"
#include "priv/esp_heap_caps_priv.h"
-#include "esp_log.h"
-
//#define CONFIG_TRACE_ALL
//#define CONFIG_TRACE_MEM_LINK 1
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
+#include "esp_log.h"
+
#ifdef CONFIG_TRACE_ALL
#define HEAP_INFO_STATE " is %s"
#define HEAP_INFO_STATE_PARAM(_p) ,mem_blk_is_used(_p)?"used":"freed"
@@ -108,10 +108,10 @@ void heap_trace_dump(void)
_heap_caps_lock(num);
- ESP_LOGI(TAG, "\r\n\r\n");
- ESP_LOGD(TAG, "start %p end %p", mem_start, mem_end);
- ESP_LOGD(TAG, "free blk %p", g_heap_region[num].free_blk);
- ESP_LOGD(TAG, "size %d mini size %d", g_heap_region[num].free_bytes, g_heap_region[num].min_free_bytes);
+ ESP_EARLY_LOGI(TAG, "\r\n\r\n");
+ ESP_EARLY_LOGD(TAG, "start %p end %p", mem_start, mem_end);
+ ESP_EARLY_LOGD(TAG, "free blk %p", g_heap_region[num].free_blk);
+ ESP_EARLY_LOGD(TAG, "size %d mini size %d", g_heap_region[num].free_bytes, g_heap_region[num].min_free_bytes);
p = mem_start;
while (p != mem_end) {
@@ -120,7 +120,7 @@ void heap_trace_dump(void)
size_t line = mem2_blk_line(mem2_blk);
if (!line) {
- ESP_LOGI(TAG, HEAP_INFO " caller func %p", HEAP_INFO_PARAM(p), mem2_blk->file);
+ ESP_EARLY_LOGI(TAG, HEAP_INFO " caller func %p", HEAP_INFO_PARAM(p), mem2_blk->file);
} else {
const char *file = rindex(mem2_blk->file, '/');
if (file)
@@ -128,7 +128,7 @@ void heap_trace_dump(void)
else
file = mem2_blk->file;
- ESP_LOGI(TAG, HEAP_INFO " caller file %s line %d", HEAP_INFO_PARAM(p), file, line);
+ ESP_EARLY_LOGI(TAG, HEAP_INFO " caller file %s line %d", HEAP_INFO_PARAM(p), file, line);
}
}
#ifdef CONFIG_TRACE_ALL
