Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
717 B

/*
* Copyright (c) 2019,2023 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/sys/sys_heap.h>
#include <zephyr/sys/util.h>
#include <zephyr/kernel.h>
#include "heap.h"
int sys_heap_runtime_stats_get(struct sys_heap *heap,
struct sys_memory_stats *stats)
{
if ((heap == NULL) || (stats == NULL)) {
return -EINVAL;
}
stats->free_bytes = heap->heap->free_bytes;
stats->allocated_bytes = heap->heap->allocated_bytes;
stats->max_allocated_bytes = heap->heap->max_allocated_bytes;
return 0;
}
int sys_heap_runtime_stats_reset_max(struct sys_heap *heap)
{
if (heap == NULL) {
return -EINVAL;
}
heap->heap->max_allocated_bytes = heap->heap->allocated_bytes;
return 0;
}