1 // -*- c++ -*- convenience wrappers around kDebug/kWarning/etc
3 #ifndef __KMAIL_KMDEBUG_H__
4 #define __KMAIL_KMDEBUG_H__
8 // Enable this to debug timing
9 // #define DEBUG_TIMING
12 #if !defined( NDEBUG ) && defined( DEBUG_TIMING )
14 #define CREATE_TIMER(x) int x=0, x ## _tmp=0; QTime x ## _tmp2
15 #define START_TIMER(x) x ## _tmp2 = QTime::currentTime()
16 #define GRAB_TIMER(x) x ## _tmp2.msecsTo(QTime::currentTime())
17 #define END_TIMER(x) x += GRAB_TIMER(x); x ## _tmp++
18 #define SHOW_TIMER(x) kDebug() << #x" ==" << x <<"(" << x ## _tmp <<")"
20 #define CREATE_TIMER(x)
21 #define START_TIMER(x)
27 // profiling utilities
28 #if !defined( NDEBUG )
29 #define CREATE_COUNTER(x) int x ## _cnt=0
30 #define RESET_COUNTER(x) x ## _cnt=0
31 #define INC_COUNTER(x) x ## _cnt++
32 #define SHOW_COUNTER(x) kDebug() << #x" ==" << x ## _cnt
34 #define CREATE_COUNTER(x)
35 #define RESET_COUNTER(x)
36 #define INC_COUNTER(x)
37 #define SHOW_COUNTER(x)
40 #endif // __KMAIL_KMDEBUG_H__