PAPI 7.1.0.0
Loading...
Searching...
No Matches
papi_memory.h
Go to the documentation of this file.
1#ifndef _PAPI_MALLOC
2#define _PAPI_MALLOC
3
4#include <stdlib.h>
5
6#define DEBUG_FILE_LEN 20
7
8typedef struct pmem
9{
10 void *ptr;
11 int size;
12#ifdef DEBUG
14 int line;
15#endif
16 struct pmem *next;
17 struct pmem *prev;
18} pmem_t;
19
20#ifndef IN_MEM_FILE
21#ifdef PAPI_NO_MEMORY_MANAGEMENT
22#define papi_malloc(a) malloc(a)
23#define papi_free(a) free(a)
24#define papi_realloc(a,b) realloc(a,b)
25#define papi_calloc(a,b) calloc(a,b)
26#define papi_valid_free(a) 1
27#define papi_strdup(a) strdup(a)
28#define papi_mem_cleanup_all() ;
29#define papi_mem_print_info(a) ;
30#define papi_mem_print_stats() ;
31#define papi_mem_overhead(a) ;
32#define papi_mem_check_all_overflow() ;
33#else
34#define papi_malloc(a) _papi_malloc(__FILE__,__LINE__, a)
35#define papi_free(a) _papi_free(__FILE__,__LINE__, a)
36#define papi_realloc(a,b) _papi_realloc(__FILE__,__LINE__,a,b)
37#define papi_calloc(a,b) _papi_calloc(__FILE__,__LINE__,a,b)
38#define papi_valid_free(a) _papi_valid_free(__FILE__,__LINE__,a)
39#define papi_strdup(a) _papi_strdup(__FILE__,__LINE__,a)
40#define papi_mem_cleanup_all _papi_mem_cleanup_all
41#define papi_mem_print_info(a) _papi_mem_print_info(a)
42#define papi_mem_print_stats _papi_mem_print_stats
43#define papi_mem_overhead(a) _papi_mem_overhead(a)
44#define papi_mem_check_all_overflow _papi_mem_check_all_overflow
45#endif
46#endif
47
48void *_papi_malloc( char *, int, size_t );
49void _papi_free( char *, int, void * );
50void *_papi_realloc( char *, int, void *, size_t );
51void *_papi_calloc( char *, int, size_t, size_t );
52int _papi_valid_free( char *, int, void * );
53char *_papi_strdup( char *, int, const char *s );
55void _papi_mem_print_info( void *ptr );
57int _papi_mem_overhead( int );
59
60#define PAPI_MEM_LIB_OVERHEAD 1 /* PAPI Library Overhead */
61#define PAPI_MEM_OVERHEAD 2 /* Memory Overhead */
62#endif
double s
Definition: byte_profile.c:36
#define DEBUG_FILE_LEN
Definition: papi_memory.h:6
void * _papi_malloc(char *, int, size_t)
Definition: papi_memory.c:124
void _papi_mem_print_stats()
Definition: papi_memory.c:262
void * _papi_calloc(char *, int, size_t, size_t)
Definition: papi_memory.c:113
void * _papi_realloc(char *, int, void *, size_t)
Definition: papi_memory.c:77
void _papi_mem_cleanup_all()
Definition: papi_memory.c:303
char * _papi_strdup(char *, int, const char *s)
Definition: papi_memory.c:169
int _papi_mem_overhead(int)
Definition: papi_memory.c:280
int _papi_valid_free(char *, int, void *)
Definition: papi_memory.c:191
void _papi_free(char *, int, void *)
Definition: papi_memory.c:226
void _papi_mem_print_info(void *ptr)
Definition: papi_memory.c:247
int _papi_mem_check_all_overflow()
Definition: papi_memory.c:470
const char FILE * file
Definition: pscanf.h:13
void * ptr
Definition: papi_memory.h:10
int line
Definition: papi_memory.h:14
struct pmem * next
Definition: papi_memory.h:16
struct pmem * prev
Definition: papi_memory.h:17
int size
Definition: papi_memory.h:11