feat(heap-trace): Add a pause state to the heap tracing

This commit adds a feature to pause the heap tracing in the
sense that in this state, the heap tracing will no longer
record the new allocations but will continue to monitor
the free() in order to keep track of the status of the
allocations present in the list of records.

See https://github.com/espressif/esp-idf/issues/13803
This commit is contained in:
Guillaume Souchere
2024-05-20 14:18:26 +02:00
parent 375a4b878e
commit 3f366d6e8b
3 changed files with 111 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -112,10 +112,25 @@ esp_err_t heap_trace_start(heap_trace_mode_t mode);
* @return
* - ESP_ERR_NOT_SUPPORTED Project was compiled without heap tracing enabled in menuconfig.
* - ESP_ERR_INVALID_STATE Heap tracing was not in progress.
* - ESP_OK Heap tracing stopped..
* - ESP_OK Heap tracing stopped.
*/
esp_err_t heap_trace_stop(void);
/**
* @brief Pause heap tracing of allocations.
*
* @note This function puts the heap tracing in the state where the new allocations
* will no longer be traced but the free will still be. This can be used to e.g.,
* strategically monitor a set of allocations to make sure each of them will get freed
* without polluting the list of records with unwanted allocations.
*
* @return
* - ESP_ERR_NOT_SUPPORTED Project was compiled without heap tracing enabled in menuconfig.
* - ESP_ERR_INVALID_STATE Heap tracing was not in progress.
* - ESP_OK Heap tracing paused.
*/
esp_err_t heap_trace_alloc_pause(void);
/**
* @brief Resume heap tracing which was previously stopped.
*