,,

Fork of Application by Daniel Sygut

Committer:
Zaitsev
Date:
Thu Feb 15 14:29:23 2018 +0000
Revision:
15:2a20c3d2616e
Parent:
10:41552d038a69
j

Who changed what in which revision?

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