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:
AnnaBridge
Date:
Thu Nov 09 11:14:10 2017 +0000
Revision:
157:e7ca05fa8600
Parent:
156:ff21514d8981
Child:
158:1c57384330a6
Release 155 of the mbed library.

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