#include "proxysql.h" #include "proxysql_atomic.h" #include #ifdef DEBUG #ifdef DEBUG_EXTERN #undef DEBUG_EXTERN #endif /* DEBUG_EXTERN */ #endif /* DEBUG */ #ifdef DEBUG static unsigned long long pretime=0; static spinlock debug_spinlock; #endif /* DEBUG */ static inline unsigned long long debug_monotonic_time() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((unsigned long long) ts.tv_sec) * 1000000) + (ts.tv_nsec / 1000); } #define DEBUG_MSG_MAXSIZE 1024 #ifdef DEBUG void proxy_debug_func(enum debug_module module, int verbosity, int thr, const char *__file, int __line, const char *__func, const char *fmt, ...) { assert(module=10) { void *arr[20]; char **strings; int s; s = backtrace(arr, 20); //backtrace_symbols_fd(arr, s, STDERR_FILENO); strings=backtrace_symbols(arr,s); if (strings == NULL) { perror("backtrace_symbols"); exit(EXIT_FAILURE); } for (int i=0; i