1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSScoreHeap |
---|
5 | * |
---|
6 | * @brief Heap Handler Information API |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2006. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_SCORE_HEAPINFO_H |
---|
19 | #define _RTEMS_SCORE_HEAPINFO_H |
---|
20 | |
---|
21 | #include <stdint.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | /** |
---|
28 | * @addtogroup RTEMSScoreHeap |
---|
29 | * |
---|
30 | * @{ |
---|
31 | */ |
---|
32 | |
---|
33 | /** |
---|
34 | * @brief Run-time heap statistics. |
---|
35 | * |
---|
36 | * The value @a searches / @a allocs gives the mean number of searches per |
---|
37 | * allocation, while @a max_search gives maximum number of searches ever |
---|
38 | * performed on a single allocation call. |
---|
39 | */ |
---|
40 | typedef struct { |
---|
41 | /** |
---|
42 | * @brief Lifetime number of bytes allocated from this heap. |
---|
43 | * |
---|
44 | * This value is an integral multiple of the page size. |
---|
45 | */ |
---|
46 | uint64_t lifetime_allocated; |
---|
47 | |
---|
48 | /** |
---|
49 | * @brief Lifetime number of bytes freed to this heap. |
---|
50 | * |
---|
51 | * This value is an integral multiple of the page size. |
---|
52 | */ |
---|
53 | uint64_t lifetime_freed; |
---|
54 | |
---|
55 | /** |
---|
56 | * @brief Size of the allocatable area in bytes. |
---|
57 | * |
---|
58 | * This value is an integral multiple of the page size. |
---|
59 | */ |
---|
60 | uintptr_t size; |
---|
61 | |
---|
62 | /** |
---|
63 | * @brief Current free size in bytes. |
---|
64 | * |
---|
65 | * This value is an integral multiple of the page size. |
---|
66 | */ |
---|
67 | uintptr_t free_size; |
---|
68 | |
---|
69 | /** |
---|
70 | * @brief Minimum free size ever in bytes. |
---|
71 | * |
---|
72 | * This value is an integral multiple of the page size. |
---|
73 | */ |
---|
74 | uintptr_t min_free_size; |
---|
75 | |
---|
76 | /** |
---|
77 | * @brief Current number of free blocks. |
---|
78 | */ |
---|
79 | uint32_t free_blocks; |
---|
80 | |
---|
81 | /** |
---|
82 | * @brief Maximum number of free blocks ever. |
---|
83 | */ |
---|
84 | uint32_t max_free_blocks; |
---|
85 | |
---|
86 | /** |
---|
87 | * @brief Current number of used blocks. |
---|
88 | */ |
---|
89 | uint32_t used_blocks; |
---|
90 | |
---|
91 | /** |
---|
92 | * @brief Maximum number of blocks searched ever. |
---|
93 | */ |
---|
94 | uint32_t max_search; |
---|
95 | |
---|
96 | /** |
---|
97 | * @brief Total number of searches. |
---|
98 | */ |
---|
99 | uint32_t searches; |
---|
100 | |
---|
101 | /** |
---|
102 | * @brief Total number of successful allocations. |
---|
103 | */ |
---|
104 | uint32_t allocs; |
---|
105 | |
---|
106 | /** |
---|
107 | * @brief Total number of failed allocations. |
---|
108 | */ |
---|
109 | uint32_t failed_allocs; |
---|
110 | |
---|
111 | /** |
---|
112 | * @brief Total number of successful frees. |
---|
113 | */ |
---|
114 | uint32_t frees; |
---|
115 | |
---|
116 | /** |
---|
117 | * @brief Total number of successful resizes. |
---|
118 | */ |
---|
119 | uint32_t resizes; |
---|
120 | } Heap_Statistics; |
---|
121 | |
---|
122 | /** |
---|
123 | * @brief Information about blocks. |
---|
124 | */ |
---|
125 | typedef struct { |
---|
126 | /** |
---|
127 | * @brief Number of blocks of this type. |
---|
128 | */ |
---|
129 | uintptr_t number; |
---|
130 | |
---|
131 | /** |
---|
132 | * @brief Largest block of this type. |
---|
133 | */ |
---|
134 | uintptr_t largest; |
---|
135 | |
---|
136 | /** |
---|
137 | * @brief Total size of the blocks of this type. |
---|
138 | */ |
---|
139 | uintptr_t total; |
---|
140 | } Heap_Information; |
---|
141 | |
---|
142 | /** |
---|
143 | * @brief Information block returned by _Heap_Get_information(). |
---|
144 | */ |
---|
145 | typedef struct { |
---|
146 | Heap_Information Free; |
---|
147 | Heap_Information Used; |
---|
148 | Heap_Statistics Stats; |
---|
149 | } Heap_Information_block; |
---|
150 | |
---|
151 | /** @} */ |
---|
152 | |
---|
153 | #ifdef __cplusplus |
---|
154 | } |
---|
155 | #endif |
---|
156 | |
---|
157 | #endif |
---|
158 | /* end of include file */ |
---|