4.115
Last change
on this file since 183af89 was
a89ae540,
checked in by Sebastian Huber <sebastian.huber@…>, on 12/06/11 at 14:23:26
|
2011-12-06 Sebastian Huber <sebastian.huber@…>
- score/src/heapiterate.c, score/src/pheapiterate.c: New files.
- score/Makefile.am: Reflect changes above.
- score/include/rtems/score/heap.h: Declare _Heap_Iterate() and define
Heap_Block_visitor.
- score/include/rtems/score/protectedheap.h: Declare
_Protected_heap_Iterate().
- score/src/heapgetinfo.c: Use _Heap_Iterate().
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreHeap |
---|
5 | * |
---|
6 | * @brief Heap Handler implementation. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2009. |
---|
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.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #if HAVE_CONFIG_H |
---|
21 | #include "config.h" |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <string.h> |
---|
25 | |
---|
26 | #include <rtems/score/heap.h> |
---|
27 | |
---|
28 | static bool _Heap_Get_information_visitor( |
---|
29 | const Heap_Block *block __attribute__((unused)), |
---|
30 | uintptr_t block_size, |
---|
31 | bool block_is_used, |
---|
32 | void *visitor_arg |
---|
33 | ) |
---|
34 | { |
---|
35 | Heap_Information_block *info_block = visitor_arg; |
---|
36 | Heap_Information *info = block_is_used ? |
---|
37 | &info_block->Used : &info_block->Free; |
---|
38 | |
---|
39 | ++info->number; |
---|
40 | info->total += block_size; |
---|
41 | if ( info->largest < block_size ) |
---|
42 | info->largest = block_size; |
---|
43 | |
---|
44 | return false; |
---|
45 | } |
---|
46 | |
---|
47 | void _Heap_Get_information( |
---|
48 | Heap_Control *the_heap, |
---|
49 | Heap_Information_block *the_info |
---|
50 | ) |
---|
51 | { |
---|
52 | memset( the_info, 0, sizeof(*the_info) ); |
---|
53 | _Heap_Iterate( the_heap, _Heap_Get_information_visitor, the_info ); |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.