diff options
author | beber <beber> | 2005-12-09 22:28:13 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-09 22:28:13 +0000 |
commit | 1bd7932bef84af9a3ab6125b2ae5ff9d1aaeff6a (patch) | |
tree | 642e7925378e5707dfb5a750b19cab19497fcf66 /src/espik_debug.h | |
parent | iadd a macro for ecore (diff) | |
download | espik-1bd7932bef84af9a3ab6125b2ae5ff9d1aaeff6a.tar.xz |
Add a profiler in code
Diffstat (limited to 'src/espik_debug.h')
-rw-r--r-- | src/espik_debug.h | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/espik_debug.h b/src/espik_debug.h index dca4f5f..75c65a1 100644 --- a/src/espik_debug.h +++ b/src/espik_debug.h @@ -3,14 +3,15 @@ #include "espik_global.h" -#define DEBUG_FILENO stderr +#define DEBUG_PRINT_FILENO stdout +#define DEBUG_ENTLEV_FILENO stderr #if defined (_ESPIK_DEBUG_) && defined (__GNUC__) #define espik_debug_print(fmt, ...) \ { \ - fprintf (DEBUG_FILENO, "%s+%i @%s: '", __FILE__, __LINE__, __func__); \ - fprintf (DEBUG_FILENO, fmt, ##__VA_ARGS__); \ - fprintf (DEBUG_FILENO, "'\n"); \ + fprintf (DEBUG_PRINT_FILENO, "%s +%i @%s: '", __FILE__, __LINE__, __func__); \ + fprintf (DEBUG_PRINT_FILENO, fmt, ##__VA_ARGS__); \ + fprintf (DEBUG_PRINT_FILENO, "'\n"); \ } #else #define espik_debug_print(fmt, ...) \ @@ -18,6 +19,37 @@ } #endif /* _ESPIK_DEBUG_ && __GNUC__ */ +#ifdef _ESPIK_DEBUG_ +#ifndef _ESPIK_DEBIG_INDENT_LEVEL +#define _ESPIK_DEBIG_INDENT_LEVEL +int __indent_level; +#endif /* _ESPIK_DEBIG_INDENT_LEVEL */ + + +#define espik_enter() \ +{ \ + __indent_level++; \ + fprintf (DEBUG_ENTLEV_FILENO, ">(%d)%*c%s +%i @%s\n", __indent_level, __indent_level, ' ', __FILE__, __LINE__, __func__); \ +} + +#define espik_leave() \ +{ \ + fprintf (DEBUG_ENTLEV_FILENO, "<(%d)%*c%s +%i @%s\n", __indent_level, __indent_level, ' ', __FILE__, __LINE__, __func__); \ + __indent_level--; \ +} + +#else + +#define espik_enter() \ +{ \ +} + +#define espik_leave() \ +{ \ +} + +#endif /* _ESPIK_DEBUG_ */ + inline void espik_bt (void); void espik_debug_init(); void kill_me (short num); |