source: rtems/cpukit/score/src/heapgetfreeinfo.c @ 0daa8ab

5
Last change on this file since 0daa8ab was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/score/heapimpl.h>
24
25void _Heap_Get_free_information(
26  Heap_Control        *the_heap,
27  Heap_Information    *info
28)
29{
30  Heap_Block *the_block;
31  Heap_Block *const tail = _Heap_Free_list_tail(the_heap);
32
33  info->number = 0;
34  info->largest = 0;
35  info->total = 0;
36
37  for(the_block = _Heap_Free_list_first(the_heap);
38      the_block != tail;
39      the_block = the_block->next)
40  {
41    uint32_t const the_size = _Heap_Block_size(the_block);
42
43    /* As we always coalesce free blocks, prev block must have been used. */
44    _HAssert(_Heap_Is_prev_used(the_block));
45
46    info->number++;
47    info->total += the_size;
48    if ( info->largest < the_size )
49        info->largest = the_size;
50  }
51}
Note: See TracBrowser for help on using the repository browser.