source: rtems/cpukit/score/src/heapgetinfo.c @ 85b52642

4.115
Last change on this file since 85b52642 was 85b52642, checked in by Sebastian Huber <sebastian.huber@…>, on 11/14/13 at 15:21:41

heapgetinfo: Free all delayed blocks

  • 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
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <string.h>
23
24#include <rtems/score/heapimpl.h>
25
26static bool _Heap_Get_information_visitor(
27  const Heap_Block *block __attribute__((unused)),
28  uintptr_t block_size,
29  bool block_is_used,
30  void *visitor_arg
31)
32{
33  Heap_Information_block *info_block = visitor_arg;
34  Heap_Information *info = block_is_used ?
35    &info_block->Used : &info_block->Free;
36
37  ++info->number;
38  info->total += block_size;
39  if ( info->largest < block_size )
40    info->largest = block_size;
41
42  return false;
43}
44
45void _Heap_Get_information(
46  Heap_Control            *the_heap,
47  Heap_Information_block  *the_info
48)
49{
50  memset( the_info, 0, sizeof(*the_info) );
51  _Heap_Protection_free_all_delayed_blocks( the_heap );
52  _Heap_Iterate( the_heap, _Heap_Get_information_visitor, the_info );
53}
Note: See TracBrowser for help on using the repository browser.