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