Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_stats.h Source File

mbed_stats.h

00001 
00002 /** \addtogroup platform */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2016-2016 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 #ifndef MBED_STATS_H
00020 #define MBED_STATS_H
00021 #include <stdint.h>
00022 #include <stddef.h>
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 typedef struct {
00029     uint32_t current_size;      /**< Bytes allocated currently. */
00030     uint32_t max_size;          /**< Max bytes allocated at a given time. */
00031     uint32_t total_size;        /**< Cumulative sum of bytes ever allocated. */
00032     uint32_t reserved_size;     /**< Current number of bytes allocated for the heap. */
00033     uint32_t alloc_cnt;         /**< Current number of allocations. */
00034     uint32_t alloc_fail_cnt;    /**< Number of failed allocations. */
00035 } mbed_stats_heap_t;
00036 
00037 /**
00038  *  Fill the passed in heap stat structure with heap stats.
00039  *
00040  *  @param stats    A pointer to the mbed_stats_heap_t structure to fill
00041  */
00042 void mbed_stats_heap_get(mbed_stats_heap_t *stats);
00043 
00044 typedef struct {
00045     uint32_t thread_id;         /**< Identifier for thread that owns the stack. */
00046     uint32_t max_size;          /**< Sum of the maximum number of bytes used in each stack. */
00047     uint32_t reserved_size;     /**< Current number of bytes allocated for all stacks. */
00048     uint32_t stack_cnt;         /**< Number of stacks currently allocated. */
00049 } mbed_stats_stack_t;
00050 
00051 /**
00052  *  Fill the passed in structure with stack stats.
00053  *
00054  *  @param stats    A pointer to the mbed_stats_stack_t structure to fill
00055  */
00056 void mbed_stats_stack_get(mbed_stats_stack_t *stats);
00057 
00058 /**
00059  *  Fill the passed array of stat structures with the stack stats
00060  *  for each available stack.
00061  *
00062  *  @param stats    A pointer to an array of mbed_stats_stack_t structures to fill
00063  *  @param count    The number of mbed_stats_stack_t structures in the provided array
00064  *  @return         The number of mbed_stats_stack_t structures that have been filled,
00065  *                  this is equal to the number of stacks on the system.
00066  */
00067 size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count);
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 
00073 #endif
00074 
00075 /** @}*/