lib/os: use generic mem stats structure for heap
Since the retrieved heap memory statistics are identical to those of the retrieved mem_block statistics, it makes sense to use a single generic-named structure for both instead of two identical structures with different names. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
d061366f54
commit
3b7818b2d2
|
@ -9,6 +9,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <sys/mem_stats.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -67,12 +68,6 @@ struct z_heap_stress_result {
|
|||
|
||||
#ifdef CONFIG_SYS_HEAP_RUNTIME_STATS
|
||||
|
||||
struct sys_heap_runtime_stats {
|
||||
size_t free_bytes;
|
||||
size_t allocated_bytes;
|
||||
size_t max_allocated_bytes;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get the runtime statistics of a sys_heap
|
||||
*
|
||||
|
@ -81,7 +76,7 @@ struct sys_heap_runtime_stats {
|
|||
* @return -EINVAL if null pointers, otherwise 0
|
||||
*/
|
||||
int sys_heap_runtime_stats_get(struct sys_heap *heap,
|
||||
struct sys_heap_runtime_stats *stats);
|
||||
struct sys_memory_stats *stats);
|
||||
|
||||
/**
|
||||
* @brief Reset the maximum heap usage.
|
||||
|
|
|
@ -110,7 +110,7 @@ bool sys_heap_validate(struct sys_heap *heap)
|
|||
* sys_heap_runtime_stats_get function.
|
||||
*/
|
||||
size_t allocated_bytes, free_bytes;
|
||||
struct sys_heap_runtime_stats stat;
|
||||
struct sys_memory_stats stat;
|
||||
|
||||
get_alloc_info(h, &allocated_bytes, &free_bytes);
|
||||
sys_heap_runtime_stats_get(heap, &stat);
|
||||
|
@ -414,7 +414,7 @@ void sys_heap_print_info(struct sys_heap *heap, bool dump_chunks)
|
|||
#ifdef CONFIG_SYS_HEAP_RUNTIME_STATS
|
||||
|
||||
int sys_heap_runtime_stats_get(struct sys_heap *heap,
|
||||
struct sys_heap_runtime_stats *stats)
|
||||
struct sys_memory_stats *stats)
|
||||
{
|
||||
if ((heap == NULL) || (stats == NULL)) {
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue