2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Statistic events.
9 * @author Sebastian Hack
11 #ifndef FIRM_STATEVENT_T_H
12 #define FIRM_STATEVENT_T_H
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)
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)
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)
38 void stat_ev_tim_push(void);
39 void stat_ev_tim_pop(const char *name);
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);
48 static inline void stat_ev_int_(const char *name, int value)
52 (do_stat_ev_int)(name, value);
54 static inline void stat_ev_dbl_(const char *name, double value)
58 (do_stat_ev_dbl)(name, value);
60 static inline void stat_ev_ull_(const char *name, unsigned long long value)
64 (do_stat_ev_ull)(name, value);
66 static inline void stat_ev_(const char *name)
72 static inline void stat_ev_ctx_push_fmt_(const char *name, const char *fmt, ...)
78 do_stat_ev_ctx_push_vfmt(name, fmt, ap);
81 static inline void stat_ev_ctx_push_str_(const char *name, const char *str)
83 stat_ev_ctx_push_fmt_(name, "%s", str);
85 static inline void stat_ev_ctx_pop_(const char *key)
89 do_stat_ev_ctx_pop(key);
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)
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)