Elijah Stanger-Jones / mbed-dev-f303
Committer:
elijahsj
Date:
Mon Nov 09 00:02:47 2020 -0500
Revision:
1:8a094db1347f
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elijahsj 1:8a094db1347f 1
elijahsj 1:8a094db1347f 2 /** \addtogroup platform */
elijahsj 1:8a094db1347f 3 /** @{*/
elijahsj 1:8a094db1347f 4 /* mbed Microcontroller Library
elijahsj 1:8a094db1347f 5 * Copyright (c) 2016-2016 ARM Limited
elijahsj 1:8a094db1347f 6 *
elijahsj 1:8a094db1347f 7 * Licensed under the Apache License, Version 2.0 (the "License");
elijahsj 1:8a094db1347f 8 * you may not use this file except in compliance with the License.
elijahsj 1:8a094db1347f 9 * You may obtain a copy of the License at
elijahsj 1:8a094db1347f 10 *
elijahsj 1:8a094db1347f 11 * http://www.apache.org/licenses/LICENSE-2.0
elijahsj 1:8a094db1347f 12 *
elijahsj 1:8a094db1347f 13 * Unless required by applicable law or agreed to in writing, software
elijahsj 1:8a094db1347f 14 * distributed under the License is distributed on an "AS IS" BASIS,
elijahsj 1:8a094db1347f 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
elijahsj 1:8a094db1347f 16 * See the License for the specific language governing permissions and
elijahsj 1:8a094db1347f 17 * limitations under the License.
elijahsj 1:8a094db1347f 18 */
elijahsj 1:8a094db1347f 19 #ifndef MBED_STATS_H
elijahsj 1:8a094db1347f 20 #define MBED_STATS_H
elijahsj 1:8a094db1347f 21 #include <stdint.h>
elijahsj 1:8a094db1347f 22 #include <stddef.h>
elijahsj 1:8a094db1347f 23
elijahsj 1:8a094db1347f 24 #ifdef __cplusplus
elijahsj 1:8a094db1347f 25 extern "C" {
elijahsj 1:8a094db1347f 26 #endif
elijahsj 1:8a094db1347f 27
elijahsj 1:8a094db1347f 28 typedef struct {
elijahsj 1:8a094db1347f 29 uint32_t current_size; /**< Bytes allocated currently. */
elijahsj 1:8a094db1347f 30 uint32_t max_size; /**< Max bytes allocated at a given time. */
elijahsj 1:8a094db1347f 31 uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
elijahsj 1:8a094db1347f 32 uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */
elijahsj 1:8a094db1347f 33 uint32_t alloc_cnt; /**< Current number of allocations. */
elijahsj 1:8a094db1347f 34 uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
elijahsj 1:8a094db1347f 35 } mbed_stats_heap_t;
elijahsj 1:8a094db1347f 36
elijahsj 1:8a094db1347f 37 /**
elijahsj 1:8a094db1347f 38 * Fill the passed in heap stat structure with heap stats.
elijahsj 1:8a094db1347f 39 *
elijahsj 1:8a094db1347f 40 * @param stats A pointer to the mbed_stats_heap_t structure to fill
elijahsj 1:8a094db1347f 41 */
elijahsj 1:8a094db1347f 42 void mbed_stats_heap_get(mbed_stats_heap_t *stats);
elijahsj 1:8a094db1347f 43
elijahsj 1:8a094db1347f 44 typedef struct {
elijahsj 1:8a094db1347f 45 uint32_t thread_id; /**< Identifier for thread that owns the stack or 0 if multiple threads. */
elijahsj 1:8a094db1347f 46 uint32_t max_size; /**< Maximum number of bytes used on the stack. */
elijahsj 1:8a094db1347f 47 uint32_t reserved_size; /**< Current number of bytes allocated for the stack. */
elijahsj 1:8a094db1347f 48 uint32_t stack_cnt; /**< Number of stacks stats accumulated in the structure. */
elijahsj 1:8a094db1347f 49 } mbed_stats_stack_t;
elijahsj 1:8a094db1347f 50
elijahsj 1:8a094db1347f 51 /**
elijahsj 1:8a094db1347f 52 * Fill the passed in structure with stack stats accumulated for all threads. The thread_id will be 0
elijahsj 1:8a094db1347f 53 * and stack_cnt will represent number of threads.
elijahsj 1:8a094db1347f 54 *
elijahsj 1:8a094db1347f 55 * @param stats A pointer to the mbed_stats_stack_t structure to fill
elijahsj 1:8a094db1347f 56 */
elijahsj 1:8a094db1347f 57 void mbed_stats_stack_get(mbed_stats_stack_t *stats);
elijahsj 1:8a094db1347f 58
elijahsj 1:8a094db1347f 59 /**
elijahsj 1:8a094db1347f 60 * Fill the passed array of stat structures with the stack stats for each available thread.
elijahsj 1:8a094db1347f 61 *
elijahsj 1:8a094db1347f 62 * @param stats A pointer to an array of mbed_stats_stack_t structures to fill
elijahsj 1:8a094db1347f 63 * @param count The number of mbed_stats_stack_t structures in the provided array
elijahsj 1:8a094db1347f 64 * @return The number of mbed_stats_stack_t structures that have been filled,
elijahsj 1:8a094db1347f 65 * this is equal to the number of stacks on the system.
elijahsj 1:8a094db1347f 66 */
elijahsj 1:8a094db1347f 67 size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count);
elijahsj 1:8a094db1347f 68
elijahsj 1:8a094db1347f 69 #ifdef __cplusplus
elijahsj 1:8a094db1347f 70 }
elijahsj 1:8a094db1347f 71 #endif
elijahsj 1:8a094db1347f 72
elijahsj 1:8a094db1347f 73 #endif
elijahsj 1:8a094db1347f 74
elijahsj 1:8a094db1347f 75 /** @}*/