2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Statistic events.
23 * @author Sebastian Hack
25 #ifndef FIRM_STATEVENT_T_H
26 #define FIRM_STATEVENT_T_H
33 #define stat_ev_enabled 0
34 #define stat_ev_dbl(name, val) ((void)0)
35 #define stat_ev_int(name, val) ((void)0)
36 #define stat_ev_ull(name, val) ((void)0)
37 #define stat_ev(name) ((void)0)
39 #define stat_ev_cnt_decl(var) ((void)0)
40 #define stat_ev_cnt_inc(var) ((void)0)
41 #define stat_ev_cnt_done(name, var) ((void)0)
42 #define stat_ev_tim_push() ((void)0)
43 #define stat_ev_tim_pop(name) ((void)0)
45 #define stat_ev_ctx_push(key) ((void)0)
46 #define stat_ev_ctx_push_str(key, str) ((void)0)
47 #define stat_ev_ctx_push_fmt(key, fmt, value) ((void)0)
48 #define stat_ev_ctx_pop(key) ((void)0)
52 void stat_ev_tim_push(void);
53 void stat_ev_tim_pop(const char *name);
55 void do_stat_ev_int(const char *name, int value);
56 void do_stat_ev_dbl(const char *name, double value);
57 void do_stat_ev_ull(const char *name, unsigned long long value);
58 void do_stat_ev(const char *name);
59 void do_stat_ev_ctx_push_vfmt(const char *name, const char *fmt, va_list ap);
60 void do_stat_ev_ctx_pop(const char *key);
62 static inline void stat_ev_int_(const char *name, int value)
66 (do_stat_ev_int)(name, value);
68 static inline void stat_ev_dbl_(const char *name, double value)
72 (do_stat_ev_dbl)(name, value);
74 static inline void stat_ev_ull_(const char *name, unsigned long long value)
78 (do_stat_ev_ull)(name, value);
80 static inline void stat_ev_(const char *name)
86 static inline void stat_ev_ctx_push_fmt_(const char *name, const char *fmt, ...)
92 do_stat_ev_ctx_push_vfmt(name, fmt, ap);
95 static inline void stat_ev_ctx_push_str_(const char *name, const char *str)
97 stat_ev_ctx_push_fmt_(name, "%s", str);
99 static inline void stat_ev_ctx_pop_(const char *key)
101 if (!stat_ev_enabled)
103 do_stat_ev_ctx_pop(key);
105 #define stat_ev_int(name, value) stat_ev_int_(name, value)
106 #define stat_ev_dbl(name, value) stat_ev_dbl_(name, value)
107 #define stat_ev_ull(name, value) stat_ev_ull_(name, value)
108 #define stat_ev(name) stat_ev_(name)
109 #define stat_ev_ctx_push_fmt(name, fmt, value) \
110 stat_ev_ctx_push_fmt_(name, fmt, value)
111 #define stat_ev_ctx_push_str(name, str) stat_ev_ctx_push_str_(name, str)
112 #define stat_ev_ctx_pop(name) stat_ev_ctx_pop_(name)
114 #define stat_ev_cnt_decl(var) int stat_ev_cnt_var_ ## var = 0
115 #define stat_ev_cnt_inc(var) do { ++stat_ev_cnt_var_ ## var; } while(0)
116 #define stat_ev_cnt_done(var, name) stat_ev_int((name), stat_ev_cnt_var_ ## var)