source: rtems/cpukit/score/src/heapgetfreeinfo.c @ 9b3f187

4.104.114.84.95
Last change on this file since 9b3f187 was 9b3f187, checked in by Joel Sherrill <joel.sherrill@…>, on 11/29/04 at 22:45:43

2004-11-29 Joel Sherrill <joel@…>

  • libcsupport/src/mallocfreespace.c, rtems/Makefile.am, rtems/include/rtems/rtems/region.h, score/Makefile.am, score/include/rtems/score/heap.h, score/src/heapgetinfo.c: Add capability to return information about just the free blocks in a region or heap. Also changed the semantics of free space available to be the largest block of memory that can be allocated.
  • rtems/src/regiongetfreeinfo.c, score/src/heapgetfreeinfo.c: New files. : score/include/rtems/score/object.h, score/src/objectinitializeinformation.c: Remove warning.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Heap Handler
3 *
4 *  COPYRIGHT (c) 1989-2004.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14
15#include <rtems/system.h>
16#include <rtems/score/sysstate.h>
17#include <rtems/score/heap.h>
18
19/*PAGE
20 *
21 *  _Heap_Get_free_information
22 *
23 *  This heap routine returns information about the free blocks
24 *  in the specified heap.
25 *
26 *  Input parameters:
27 *    the_heap  - pointer to heap header.
28 *    info      - pointer to the free block information.
29 *
30 *  Output parameters:
31 *    returns - free block information filled in.
32 */
33
34void _Heap_Get_free_information(
35  Heap_Control        *the_heap,
36  Heap_Information    *info
37)
38{
39  Heap_Block *the_block;
40
41  info->number = 0;
42  info->largest = 0;
43  info->total = 0;
44
45  for ( the_block = the_heap->first;
46        ;
47        the_block = the_block->next ) {
48    if ( the_block == _Heap_Tail( the_heap ) )
49      return;
50   
51    info->number++;
52    info->largest = 0;
53    info->total += the_block->front_flag;
54
55    if ( the_block->front_flag >= info->largest )
56      info->largest = the_block->front_flag;
57  }
58}
Note: See TracBrowser for help on using the repository browser.