The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Anna Bridge
Date:
Wed Jan 17 16:13:02 2018 +0000
Revision:
160:5571c4ff569f
Parent:
158:1c57384330a6
Child:
169:a7c7b631e539
mbed library. Release version 158

Who changed what in which revision?

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