Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
mbed_stats.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /** 00005 * \defgroup platform_stats stats functions 00006 * @{ 00007 */ 00008 /* mbed Microcontroller Library 00009 * Copyright (c) 2016-2016 ARM Limited 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 */ 00023 #ifndef MBED_STATS_H 00024 #define MBED_STATS_H 00025 #include <stdint.h> 00026 #include <stddef.h> 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /** 00033 * struct mbed_stats_heap_t definition 00034 */ 00035 typedef struct { 00036 uint32_t current_size; /**< Bytes allocated currently. */ 00037 uint32_t max_size; /**< Max bytes allocated at a given time. */ 00038 uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */ 00039 uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */ 00040 uint32_t alloc_cnt; /**< Current number of allocations. */ 00041 uint32_t alloc_fail_cnt; /**< Number of failed allocations. */ 00042 } mbed_stats_heap_t; 00043 00044 /** 00045 * Fill the passed in heap stat structure with heap stats. 00046 * 00047 * @param stats A pointer to the mbed_stats_heap_t structure to fill 00048 */ 00049 void mbed_stats_heap_get(mbed_stats_heap_t *stats); 00050 00051 /** 00052 * struct mbed_stats_stack_t definition 00053 */ 00054 typedef struct { 00055 uint32_t thread_id; /**< Identifier for thread that owns the stack or 0 if multiple threads. */ 00056 uint32_t max_size; /**< Maximum number of bytes used on the stack. */ 00057 uint32_t reserved_size; /**< Current number of bytes allocated for the stack. */ 00058 uint32_t stack_cnt; /**< Number of stacks stats accumulated in the structure. */ 00059 } mbed_stats_stack_t; 00060 00061 /** 00062 * Fill the passed in structure with stack stats accumulated for all threads. The thread_id will be 0 00063 * and stack_cnt will represent number of threads. 00064 * 00065 * @param stats A pointer to the mbed_stats_stack_t structure to fill 00066 */ 00067 void mbed_stats_stack_get(mbed_stats_stack_t *stats); 00068 00069 /** 00070 * Fill the passed array of stat structures with the stack stats for each available thread. 00071 * 00072 * @param stats A pointer to an array of mbed_stats_stack_t structures to fill 00073 * @param count The number of mbed_stats_stack_t structures in the provided array 00074 * @return The number of mbed_stats_stack_t structures that have been filled, 00075 * this is equal to the number of stacks on the system. 00076 */ 00077 size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count); 00078 00079 #ifdef __cplusplus 00080 } 00081 #endif 00082 00083 #endif 00084 00085 /** @}*/ 00086 00087 /** @}*/
Generated on Sun Jul 17 2022 08:25:27 by 1.7.2