krop's commit fixes my problem in a better way, reverting
[kdepim.git] / kmail / kmdebug.h
blob4a1e2c7dc4d9a45e266cd116cfa10d942c01aac4
1 // -*- c++ -*- convenience wrappers around kDebug/kWarning/etc
3 #ifndef __KMAIL_KMDEBUG_H__
4 #define __KMAIL_KMDEBUG_H__
6 #include <kdebug.h>
8 // Enable this to debug timing
9 // #define DEBUG_TIMING
11 // timing utilities
12 #if !defined( NDEBUG ) && defined( DEBUG_TIMING )
13 #include <QDateTime>
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 <<")"
19 #else
20 #define CREATE_TIMER(x)
21 #define START_TIMER(x)
22 #define GRAB_TIMER(x)
23 #define END_TIMER(x)
24 #define SHOW_TIMER(x)
25 #endif
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
33 #else
34 #define CREATE_COUNTER(x)
35 #define RESET_COUNTER(x)
36 #define INC_COUNTER(x)
37 #define SHOW_COUNTER(x)
38 #endif
40 #endif // __KMAIL_KMDEBUG_H__