OVMS3-idf/components/heap/include/esp_heap_debug.h
Stephen Casner a376475c2b Add esp_heap_debug_dump_totals() to monitor heap usage
esp_heap_debug_dump_totals() dumps into a user-provided data structure
a summary of the amound of heap memory in region type that is used by
each task.  Optionally it will also dump into another data structure
the metadata about each allocated block for a given list of tasks or
for all tasks (limited by available space).
2018-01-10 09:06:50 -08:00

40 lines
864 B
C

#ifndef _ESP_HEAP_DEBUG_H
#define _ESP_HEAP_DEBUG_H
#ifdef CONFIG_HEAP_TASK_TRACKING
#ifdef __cplusplus
extern "C" {
#endif
enum region_types {
DRAM = 0,
D_IRAM = 1,
IRAM = 2,
SPIRAM = 3,
NUM_USED_TYPES = 4
};
typedef struct {
TaskHandle_t task;
int size[NUM_USED_TYPES];
} heap_dump_totals_t;
typedef struct {
TaskHandle_t task;
void* address;
int size: 24; // The size of the allocated block.
int type: 7; // Type of block's region
int unused: 1; // (forces 32-bit access for type)
} heap_dump_block_t;
extern size_t esp_heap_debug_dump_totals(heap_dump_totals_t* totals, size_t* ntotal, size_t max,
TaskHandle_t* tasks, size_t ntasks,
heap_dump_block_t* buffer, size_t size);
#ifdef __cplusplus
}
#endif
#endif
#endif // _ESP_HEAP_DEBUG_H