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