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