source: rtems/cpukit/score/src/heapgetfreeinfo.c @ c86da31c

4.115
Last change on this file since c86da31c was dea3eccb, checked in by Joel Sherrill <joel.sherrill@…>, on 09/06/09 at 15:24:08

2009-09-06 Sebastian Huber <Sebastian.Huber@…>

  • libcsupport/src/free.c, libmisc/stackchk/check.c, rtems/include/rtems/rtems/region.h, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetinfo.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionresizesegment.c, score/src/pheapallocate.c, score/src/pheapallocatealigned.c, score/src/pheapextend.c, score/src/pheapfree.c, score/src/pheapgetblocksize.c, score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c, score/src/pheapgetsize.c, score/src/pheapinit.c, score/src/pheapresizeblock.c, score/src/pheapwalk.c: Update for heap API changes.
  • score/include/rtems/score/apimutex.h, score/include/rtems/score/object.h: Documentation.
  • score/include/rtems/score/heap.h, score/include/rtems/score/protectedheap.h, score/inline/rtems/score/heap.inl, score/src/heap.c, score/src/heapallocate.c, score/src/heapallocatealigned.c, score/src/heapextend.c, score/src/heapfree.c, score/src/heapgetfreeinfo.c, score/src/heapgetinfo.c, score/src/heapresizeblock.c, score/src/heapsizeofuserarea.c, score/src/heapwalk.c: Overall cleanup. Added boundary constraint to allocation function. More changes follow.
  • 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-2004.
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 <rtems/system.h>
25#include <rtems/score/sysstate.h>
26#include <rtems/score/heap.h>
27
28void _Heap_Get_free_information(
29  Heap_Control        *the_heap,
30  Heap_Information    *info
31)
32{
33  Heap_Block *the_block;
34  Heap_Block *const tail = _Heap_Free_list_tail(the_heap);
35
36  info->number = 0;
37  info->largest = 0;
38  info->total = 0;
39
40  for(the_block = _Heap_Free_list_first(the_heap);
41      the_block != tail;
42      the_block = the_block->next)
43  {
44    uint32_t const the_size = _Heap_Block_size(the_block);
45
46    /* As we always coalesce free blocks, prev block must have been used. */
47    _HAssert(_Heap_Is_prev_used(the_block));
48
49    info->number++;
50    info->total += the_size;
51    if ( info->largest < the_size )
52        info->largest = the_size;
53  }
54}
Note: See TracBrowser for help on using the repository browser.