mkernel 0.0.1
Micro-kernel framework, everything as a module
memtrack.h
Go to the documentation of this file.
1
19#ifndef __MEMTRACK_H__
20#define __MEMTRACK_H__
21
22#ifdef HAVE_CONFIG_H
23# include "config.h"
24#endif
25
26#include <stdlib.h> /* size_t */
27#include <stdint.h> /* uint64_t */
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37typedef struct MemBlock {
38 struct MemBlock *Prev;
39 struct MemBlock *Next;
40 void *Ptr;
41 size_t Size;
42 char *File;
43 int Line;
44 char *CompilDate;
45 char *CompilTime;
46 char *Function;
48
79extern unsigned int (*memtrack_addblock) (const void *p_Ptr,
80 const size_t p_Size,
81 const char *p_File,
82 const int p_Line,
83 const char *p_CompilDate,
84 const char *p_CompilTime,
85 const char *p_Function);
86
115extern unsigned int (*memtrack_delblock) (const void *p_Ptr,
116 const char *p_File,
117 const int p_Line,
118 const char *p_CompilDate,
119 const char *p_CompilTime,
120 const char *p_Function);
121
135extern uint64_t (*memtrack_dumpblocks) ();
136
149extern uint64_t (*memtrack_getallocatedblocks) ();
150
163extern uint64_t (*memtrack_getallocatedRAM) ();
164
182extern size_t(*memtrack_getblocksize) (const void *p_Ptr);
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif /* __MEMTRACK_H__ */
189
size_t(* memtrack_getblocksize)(const void *p_Ptr)
Functor to get size of a specific memory block.
Definition: memtrack.c:621
uint64_t(* memtrack_getallocatedblocks)()
Functor to get the number of allocated blocks.
Definition: memtrack.c:615
struct MemBlock TMemBlock
Memory block metadata list item.
uint64_t(* memtrack_getallocatedRAM)()
Functor to get the total RAM size allocated.
Definition: memtrack.c:618
unsigned int(* memtrack_delblock)(const void *p_Ptr, const char *p_File, const int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function)
Functor to unregister an allocated memory block metadata.
Definition: memtrack.c:603
uint64_t(* memtrack_dumpblocks)()
Functor to list allocated memory blocks metadata.
Definition: memtrack.c:612
unsigned int(* memtrack_addblock)(const void *p_Ptr, const size_t p_Size, const char *p_File, const int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function)
Functor to register an allocated memory block metadata.
Definition: memtrack.c:593
Memory block metadata list item.
Definition: memtrack.h:37
size_t Size
Allocated memory block size.
Definition: memtrack.h:41
struct MemBlock * Prev
Previous item pointer.
Definition: memtrack.h:38
struct MemBlock * Next
Next item pointer.
Definition: memtrack.h:39
char * CompilDate
Source file compilation date.
Definition: memtrack.h:44
char * CompilTime
Source file compilation time.
Definition: memtrack.h:45
char * File
Source file which asked the allocation.
Definition: memtrack.h:42
char * Function
Fonction name which asked the allocation.
Definition: memtrack.h:46
void * Ptr
Allocated memory block pointer.
Definition: memtrack.h:40
int Line
Source line number ch asked the allocation.
Definition: memtrack.h:43