source: rtems/cpukit/score/src/heapgetfreeinfo.c @ 25bcb1dd

4.104.114.84.95
Last change on this file since 25bcb1dd was 25bcb1dd, checked in by Joel Sherrill <joel.sherrill@…>, on 01/20/05 at 17:21:34

2005-01-20 Joel Sherrill <joel@…>

PR 740/rtems

  • score/src/heapgetfreeinfo.c: Return size of largest not of last block.
  • 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->total += the_block->front_flag;
53
54    if ( the_block->front_flag >= info->largest )
55      info->largest = the_block->front_flag;
56  }
57}
Note: See TracBrowser for help on using the repository browser.