Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSScoreHeap
0007  *
0008  * @brief This header file provides interfaces of the
0009  *   @ref RTEMSScoreBarrier which are used by the implementation and the API.
0010  */
0011 
0012 /*
0013  *  COPYRIGHT (c) 1989-2006.
0014  *  On-Line Applications Research Corporation (OAR).
0015  *
0016  * Redistribution and use in source and binary forms, with or without
0017  * modification, are permitted provided that the following conditions
0018  * are met:
0019  * 1. Redistributions of source code must retain the above copyright
0020  *    notice, this list of conditions and the following disclaimer.
0021  * 2. Redistributions in binary form must reproduce the above copyright
0022  *    notice, this list of conditions and the following disclaimer in the
0023  *    documentation and/or other materials provided with the distribution.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035  * POSSIBILITY OF SUCH DAMAGE.
0036  */
0037 
0038 #ifndef _RTEMS_SCORE_HEAPINFO_H
0039 #define _RTEMS_SCORE_HEAPINFO_H
0040 
0041 #include <stdint.h>
0042 
0043 #ifdef __cplusplus
0044 extern "C" {
0045 #endif
0046 
0047 /**
0048  * @addtogroup RTEMSScoreHeap
0049  *
0050  * @{
0051  */
0052 
0053 /**
0054  * @brief Run-time heap statistics.
0055  *
0056  * The value @a searches / @a allocs gives the mean number of searches per
0057  * allocation, while @a max_search gives maximum number of searches ever
0058  * performed on a single allocation call.
0059  */
0060 typedef struct {
0061   /**
0062    * @brief Lifetime number of bytes allocated from this heap.
0063    *
0064    * This value is an integral multiple of the page size.
0065    */
0066   uint64_t lifetime_allocated;
0067 
0068   /**
0069    * @brief Lifetime number of bytes freed to this heap.
0070    *
0071    * This value is an integral multiple of the page size.
0072    */
0073   uint64_t lifetime_freed;
0074 
0075   /**
0076    * @brief Size of the allocatable area in bytes.
0077    *
0078    * This value is an integral multiple of the page size.
0079    */
0080   uintptr_t size;
0081 
0082   /**
0083    * @brief Current free size in bytes.
0084    *
0085    * This value is an integral multiple of the page size.
0086    */
0087   uintptr_t free_size;
0088 
0089   /**
0090    * @brief Minimum free size ever in bytes.
0091    *
0092    * This value is an integral multiple of the page size.
0093    */
0094   uintptr_t min_free_size;
0095 
0096   /**
0097    * @brief Current number of free blocks.
0098    */
0099   uint32_t free_blocks;
0100 
0101   /**
0102    * @brief Maximum number of free blocks ever.
0103    */
0104   uint32_t max_free_blocks;
0105 
0106   /**
0107    * @brief Current number of used blocks.
0108    */
0109   uint32_t used_blocks;
0110 
0111   /**
0112    * @brief Maximum number of blocks searched ever.
0113    */
0114   uint32_t max_search;
0115 
0116   /**
0117    * @brief Total number of searches.
0118    */
0119   uint32_t searches;
0120 
0121   /**
0122    * @brief Total number of successful allocations.
0123    */
0124   uint32_t allocs;
0125 
0126   /**
0127    * @brief Total number of failed allocations.
0128    */
0129   uint32_t failed_allocs;
0130 
0131   /**
0132    * @brief Total number of successful frees.
0133    */
0134   uint32_t frees;
0135 
0136   /**
0137    * @brief Total number of successful resizes.
0138    */
0139   uint32_t resizes;
0140 } Heap_Statistics;
0141 
0142 /**
0143  * @brief Information about blocks.
0144  */
0145 typedef struct {
0146   /**
0147    * @brief Number of blocks of this type.
0148    */
0149   uintptr_t number;
0150 
0151   /**
0152    * @brief Largest block of this type.
0153    */
0154   uintptr_t largest;
0155 
0156   /**
0157    * @brief Total size of the blocks of this type.
0158    */
0159   uintptr_t total;
0160 } Heap_Information;
0161 
0162 /**
0163  * @brief Information block returned by _Heap_Get_information().
0164  */
0165 typedef struct {
0166   Heap_Information Free;
0167   Heap_Information Used;
0168   Heap_Statistics Stats;
0169 } Heap_Information_block;
0170 
0171 /** @} */
0172 
0173 #ifdef __cplusplus
0174 }
0175 #endif
0176 
0177 #endif
0178 /* end of include file */