19 #ifdef NO_VARARG_MACRO 27 #define DEBUG_SUBSTRATE 0x002 28 #define DEBUG_API 0x004 29 #define DEBUG_INTERNAL 0x008 30 #define DEBUG_THREADS 0x010 31 #define DEBUG_MULTIPLEX 0x020 32 #define DEBUG_OVERFLOW 0x040 33 #define DEBUG_PROFILE 0x080 34 #define DEBUG_MEMORY 0x100 35 #define DEBUG_LEAK 0x200 36 #define DEBUG_ALL (DEBUG_SUBSTRATE|DEBUG_API|DEBUG_INTERNAL|DEBUG_THREADS|DEBUG_MULTIPLEX|DEBUG_OVERFLOW|DEBUG_PROFILE|DEBUG_MEMORY|DEBUG_LEAK) 46 #define FUNC __FUNCTION__ 47 #elif defined(__func__) 53 #define DEBUGLABEL(a) if (_papi_hwi_thread_id_fn) fprintf(stderr, "%s:%s:%s:%d:%d:%#lx ",a,__FILE__, FUNC, __LINE__,(int)getpid(),_papi_hwi_thread_id_fn()); else fprintf(stderr, "%s:%s:%s:%d:%d ",a,__FILE__, FUNC, __LINE__, (int)getpid()) 54 #define ISLEVEL(a) (_papi_hwi_debug&a) 56 #define DEBUGLEVEL(a) ((a&DEBUG_SUBSTRATE)?"SUBSTRATE":(a&DEBUG_API)?"API":(a&DEBUG_INTERNAL)?"INTERNAL":(a&DEBUG_THREADS)?"THREADS":(a&DEBUG_MULTIPLEX)?"MULTIPLEX":(a&DEBUG_OVERFLOW)?"OVERFLOW":(a&DEBUG_PROFILE)?"PROFILE":(a&DEBUG_MEMORY)?"MEMORY":(a&DEBUG_LEAK)?"LEAK":"UNKNOWN") 58 #ifndef NO_VARARG_MACRO 59 #define PAPIDEBUG(level,format, args...) { if(_papi_hwi_debug&level){DEBUGLABEL(DEBUGLEVEL(level));fprintf(stderr,format, ## args);}} 63 #define SUBDBG(format, args...) (PAPIDEBUG(DEBUG_SUBSTRATE,format, ## args)) 64 #define APIDBG(format, args...) (PAPIDEBUG(DEBUG_API,format, ## args)) 65 #define INTDBG(format, args...) (PAPIDEBUG(DEBUG_INTERNAL,format, ## args)) 66 #define THRDBG(format, args...) (PAPIDEBUG(DEBUG_THREADS,format, ## args)) 67 #define MPXDBG(format, args...) (PAPIDEBUG(DEBUG_MULTIPLEX,format, ## args)) 68 #define OVFDBG(format, args...) (PAPIDEBUG(DEBUG_OVERFLOW,format, ## args)) 69 #define PRFDBG(format, args...) (PAPIDEBUG(DEBUG_PROFILE,format, ## args)) 70 #define MEMDBG(format, args...) (PAPIDEBUG(DEBUG_MEMORY,format, ## args)) 71 #define LEAKDBG(format, args...) (PAPIDEBUG(DEBUG_LEAK,format, ## args)) 75 #ifndef NO_VARARG_MACRO 76 #define SUBDBG(format, args...) { ; } 77 #define APIDBG(format, args...) { ; } 78 #define INTDBG(format, args...) { ; } 79 #define THRDBG(format, args...) { ; } 80 #define MPXDBG(format, args...) { ; } 81 #define OVFDBG(format, args...) { ; } 82 #define PRFDBG(format, args...) { ; } 83 #define MEMDBG(format, args...) { ; } 84 #define LEAKDBG(format, args...) { ; } 85 #define PAPIDEBUG(level, format, args...) { ; } 93 #ifdef NO_VARARG_MACRO 95 static void PAPIDEBUG(
int level,
char *format, va_list args )
100 vfprintf( stderr, format, args );
107 _SUBDBG(
char *format, ... )
117 #define SUBDBG do { \ 118 if (DEBUG_SUBSTRATE & _papi_hwi_debug) {\ 119 DEBUGLABEL( DEBUGLEVEL ( DEBUG_SUBSTRATE ) ); \ 123 #define SUBDBG _SUBDBG 127 _APIDBG(
char *format, ... )
137 #define APIDBG do { \ 138 if (DEBUG_API&_papi_hwi_debug) {\ 139 DEBUGLABEL( DEBUGLEVEL ( DEBUG_API ) ); \ 143 #define APIDBG _APIDBG 147 _INTDBG(
char *format, ... )
157 #define INTDBG do { \ 158 if (DEBUG_INTERNAL&_papi_hwi_debug) {\ 159 DEBUGLABEL( DEBUGLEVEL ( DEBUG_INTERNAL ) ); \ 163 #define INTDBG _INTDBG 167 _THRDBG(
char *format, ... )
177 #define THRDBG do { \ 178 if (DEBUG_THREADS&_papi_hwi_debug) {\ 179 DEBUGLABEL( DEBUGLEVEL ( DEBUG_THREADS ) ); \ 183 #define THRDBG _THRDBG 187 _MPXDBG(
char *format, ... )
197 #define MPXDBG do { \ 198 if (DEBUG_MULTIPLEX&_papi_hwi_debug) {\ 199 DEBUGLABEL( DEBUGLEVEL ( DEBUG_MULTIPLEX ) ); \ 203 #define MPXDBG _MPXDBG 207 _OVFDBG(
char *format, ... )
217 #define OVFDBG do { \ 218 if (DEBUG_OVERFLOW&_papi_hwi_debug) {\ 219 DEBUGLABEL( DEBUGLEVEL ( DEBUG_OVERFLOW ) ); \ 223 #define OVFDBG _OVFDBG 227 _PRFDBG(
char *format, ... )
237 #define PRFDBG do { \ 238 if (DEBUG_PROFILE&_papi_hwi_debug) {\ 239 DEBUGLABEL( DEBUGLEVEL ( DEBUG_PROFILE ) ); \ 243 #define PRFDBG _PRFDBG 247 _MEMDBG(
char *format, ... )
257 #define MEMDBG do { \ 258 if (DEBUG_MEMORY&_papi_hwi_debug) {\ 259 DEBUGLABEL( DEBUGLEVEL ( DEBUG_MEMORY ) ); \ 263 #define MEMDBG _MEMDBG 267 _LEAKDBG(
char *format, ... )
277 #define LEAKDBG do { \ 278 if (DEBUG_LEAK&_papi_hwi_debug) {\ 279 DEBUGLABEL( DEBUGLEVEL ( DEBUG_LEAK ) ); \ 283 #define LEAKDBG _LEAKDBG
unsigned long int(* _papi_hwi_thread_id_fn)(void)
#define PAPIDEBUG(level, format, args...)