source: rtems/cpukit/libcsupport/include/rtems/malloc.h @ 8e30a269

4.104.114.95
Last change on this file since 8e30a269 was 8e30a269, checked in by Joel Sherrill <joel.sherrill@…>, on 12/19/07 at 16:03:54

2007-12-19 Joel Sherrill <joel.sherrill@…>

  • libcsupport/Makefile.am, libcsupport/include/rtems/malloc.h, libcsupport/src/free.c, libcsupport/src/malloc.c, libcsupport/src/malloc_p.h, libcsupport/src/malloc_report_statistics_plugin.c, libmisc/shell/shell.c, libmisc/shell/shell.h, score/src/objectinitializeinformation.c: Add posix_memalign. Split out management of deferred frees to subroutines.
  • libcsupport/src/malloc_deferred.c, libcsupport/src/posix_memalign.c: New files.
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file rtems/malloc.h
3 */
4
5/*
6 *  RTEMS Malloc Extensions
7 *
8 *  COPYRIGHT (c) 1989-1997.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may in
12 *  the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 * $ld:
16 */
17
18#ifndef _RTEMS_MALLOC_H
19#define _RTEMS_MALLOC_H
20
21#include <rtems.h>
22#include <rtems/bspIo.h>
23
24#include <stdint.h>
25
26/*
27 *  Malloc Statistics Structure
28 */
29typedef struct {
30    uint32_t    space_available;             /* current size of malloc area */
31    uint32_t    malloc_calls;                /* # calls to malloc */
32    uint32_t    memalign_calls;              /* # calls to memalign */
33    uint32_t    free_calls;
34    uint32_t    realloc_calls;
35    uint32_t    calloc_calls;
36    uint32_t    max_depth;                   /* most ever malloc'd at 1 time */
37    uintmax_t   lifetime_allocated;
38    uintmax_t   lifetime_freed;
39} rtems_malloc_statistics_t;
40
41/*
42 *  Malloc statistics plugin
43 */
44typedef struct {
45  void (*initialize)(void);
46  void (*at_malloc)(void *);
47  void (*at_free)(void *);
48} rtems_malloc_statististics_functions_t;
49
50extern rtems_malloc_statististics_functions_t
51  rtems_malloc_statistics_helpers_table;
52extern rtems_malloc_statististics_functions_t *rtems_malloc_statistics_helpers;
53
54/*
55 *  Malloc boundary support plugin
56 */
57typedef struct {
58  void     (*initialize)(void);
59  uint32_t (*overhead)(void);
60  void     (*at_malloc)(void *, size_t);
61  void     (*at_free)(void *);
62  void     (*at_realloc)(void *, size_t);
63} rtems_malloc_boundary_functions_t;
64
65extern rtems_malloc_boundary_functions_t rtems_malloc_boundary_helpers_table;
66extern rtems_malloc_boundary_functions_t *rtems_malloc_boundary_helpers;
67
68
69
70/** @brief Print Malloc Statistic Usage Report
71 *
72 *  This method fills in the called provided malloc statistics area.
73 *
74 *  @return This method returns 0 if successful and -1 on error.
75 */
76int malloc_get_statistics(
77  rtems_malloc_statistics_t *stats
78);
79
80/** @brief Print Malloc Statistic Usage Report
81 *
82 *  This method prints a malloc statistics report.
83 *
84 *  @note It uses printk to print the report.
85 */
86void malloc_report_statistics(void);
87
88/** @brief Print Malloc Statistic Usage Report
89 *
90 *  This method prints a malloc statistics report.
91 *
92 *  @param[in] context is the context to pass to the print handler
93 *  @param[in] print is the print handler
94 *
95 *  @note It uses the CALLER's routine to print the report.
96 */
97void malloc_report_statistics_with_plugin(
98  void                  *context,
99  rtems_printk_plugin_t  print
100);
101
102#endif
Note: See TracBrowser for help on using the repository browser.