bechordal_draw: Remove the write-only attribute max_color from struct draw_chordal_env_t.
[libfirm] / ir / stat / statev_t.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Statistic events.
9  * @author      Sebastian Hack
10  */
11 #ifndef FIRM_STATEVENT_T_H
12 #define FIRM_STATEVENT_T_H
13
14 #include "statev.h"
15 #include <stdarg.h>
16
17 #ifdef DISABLE_STATEV
18
19 #define stat_ev_enabled                          0
20 #define stat_ev_dbl(name, val)                   ((void)0)
21 #define stat_ev_int(name, val)                   ((void)0)
22 #define stat_ev_ull(name, val)                   ((void)0)
23 #define stat_ev(name)                            ((void)0)
24
25 #define stat_ev_cnt_decl(var)                    ((void)0)
26 #define stat_ev_cnt_inc(var)                     ((void)0)
27 #define stat_ev_cnt_done(name, var)              ((void)0)
28 #define stat_ev_tim_push()                       ((void)0)
29 #define stat_ev_tim_pop(name)                    ((void)0)
30
31 #define stat_ev_ctx_push(key)                    ((void)0)
32 #define stat_ev_ctx_push_str(key, str)           ((void)0)
33 #define stat_ev_ctx_push_fmt(key, fmt, value)    ((void)0)
34 #define stat_ev_ctx_pop(key)                     ((void)0)
35
36 #else
37
38 void stat_ev_tim_push(void);
39 void stat_ev_tim_pop(const char *name);
40
41 void do_stat_ev_int(const char *name, int value);
42 void do_stat_ev_dbl(const char *name, double value);
43 void do_stat_ev_ull(const char *name, unsigned long long value);
44 void do_stat_ev(const char *name);
45 void do_stat_ev_ctx_push_vfmt(const char *name, const char *fmt, va_list ap);
46 void do_stat_ev_ctx_pop(const char *key);
47
48 static inline void stat_ev_int_(const char *name, int value)
49 {
50         if (!stat_ev_enabled)
51                 return;
52         (do_stat_ev_int)(name, value);
53 }
54 static inline void stat_ev_dbl_(const char *name, double value)
55 {
56         if (!stat_ev_enabled)
57                 return;
58         (do_stat_ev_dbl)(name, value);
59 }
60 static inline void stat_ev_ull_(const char *name, unsigned long long value)
61 {
62         if (!stat_ev_enabled)
63                 return;
64         (do_stat_ev_ull)(name, value);
65 }
66 static inline void stat_ev_(const char *name)
67 {
68         if (!stat_ev_enabled)
69                 return;
70         (do_stat_ev)(name);
71 }
72 static inline void stat_ev_ctx_push_fmt_(const char *name, const char *fmt, ...)
73 {
74         if (!stat_ev_enabled)
75                 return;
76         va_list ap;
77         va_start(ap, fmt);
78         do_stat_ev_ctx_push_vfmt(name, fmt, ap);
79         va_end(ap);
80 }
81 static inline void stat_ev_ctx_push_str_(const char *name, const char *str)
82 {
83         stat_ev_ctx_push_fmt_(name, "%s", str);
84 }
85 static inline void stat_ev_ctx_pop_(const char *key)
86 {
87         if (!stat_ev_enabled)
88                 return;
89         do_stat_ev_ctx_pop(key);
90 }
91 #define stat_ev_int(name, value)        stat_ev_int_(name, value)
92 #define stat_ev_dbl(name, value)        stat_ev_dbl_(name, value)
93 #define stat_ev_ull(name, value)        stat_ev_ull_(name, value)
94 #define stat_ev(name)                   stat_ev_(name)
95 #define stat_ev_ctx_push_fmt(name, fmt, value) \
96                                         stat_ev_ctx_push_fmt_(name, fmt, value)
97 #define stat_ev_ctx_push_str(name, str) stat_ev_ctx_push_str_(name, str)
98 #define stat_ev_ctx_pop(name)           stat_ev_ctx_pop_(name)
99
100 #define stat_ev_cnt_decl(var)       int stat_ev_cnt_var_ ## var = 0
101 #define stat_ev_cnt_inc(var)        do { ++stat_ev_cnt_var_ ## var; } while(0)
102 #define stat_ev_cnt_done(var, name) stat_ev_int((name), stat_ev_cnt_var_ ## var)
103
104 #endif
105
106 #endif