TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

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