source: rtems/cpukit/score/src/heapgetinfo.c @ e6f7f81

4.11
Last change on this file since e6f7f81 was e6f7f81, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 23, 2013 at 2:50:51 PM

score: Create heap implementation header

Move implementation specific parts of heap.h and heap.inl into new
header file heapimpl.h. The heap.h contains now only the application
visible API.

  • 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
[dd687d9]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) );
51  _Heap_Iterate( the_heap, _Heap_Get_information_visitor, the_info );
[252565f]52}
Note: See TracBrowser for help on using the repository browser.