Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

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