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
RevLine 
[dea3eccb]1/**
2 * @file
3 *
4 * @ingroup ScoreHeap
[252565f]5 *
[dea3eccb]6 * @brief Heap Handler implementation.
7 */
8
9/*
[a7643178]10 *  COPYRIGHT (c) 1989-2009.
[252565f]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
[dd687d97]15 *  http://www.rtems.com/license/LICENSE.
[252565f]16 */
17
[a8eed23]18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
[252565f]21
[b2a0214]22#include <string.h>
23
[e6f7f81]24#include <rtems/score/heapimpl.h>
[252565f]25
[a89ae540]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
[252565f]31)
32{
[a89ae540]33  Heap_Information_block *info_block = visitor_arg;
34  Heap_Information *info = block_is_used ?
35    &info_block->Used : &info_block->Free;
[252565f]36
[a89ae540]37  ++info->number;
38  info->total += block_size;
39  if ( info->largest < block_size )
40    info->largest = block_size;
[252565f]41
[a89ae540]42  return false;
43}
[962e894f]44
[a89ae540]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) );
[85b52642]51  _Heap_Protection_free_all_delayed_blocks( the_heap );
[a89ae540]52  _Heap_Iterate( the_heap, _Heap_Get_information_visitor, the_info );
[252565f]53}
Note: See TracBrowser for help on using the repository browser.