2 * Copyright (C) 1995-2007 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
28 #ifndef FIRM_STATEVENT_H
29 #define FIRM_STATEVENT_H
31 #ifndef FIRM_STATISTICS
33 #define stat_ev_do(expr)
34 #define stat_ev_dbl(name, val)
36 #define stat_ev_cnt_decl(var)
37 #define stat_ev_cnt_inc(var)
38 #define stat_ev_cnt_done(name, var)
41 #define stat_ev_ctx_push_fobj(key, firm_object)
42 #define stat_ev_ctx_push(key, value)
43 #define stat_ev_ctx_pop()
44 #define stat_ev_begin(prefix)
46 #define stat_ev_flush()
50 extern int stat_ev_enabled;
52 #define stat_ev_do(expr) (stat_ev_enabled ? ((expr), 1) : 0)
54 #define stat_ev_dbl(name, val) do { if (stat_ev_enabled) { stat_ev_emit(name, val); } } while(0)
56 #define stat_ev_cnt_decl(var) int stat_ev_cnt_var_ ## var = 0
57 #define stat_ev_cnt_inc(var) do { ++stat_ev_cnt_var_ ## var; } while(0)
58 #define stat_ev_cnt_done(var, name) stat_ev_dbl((name), stat_ev_cnt_var_ ## var)
60 #define stat_ev(name) stat_ev_dbl((name), 0.0)
62 void stat_ev_ctx_push_fobj(const char *key, const void *firm_object);
63 void stat_ev_ctx_push(const char *key, const char *value);
64 void stat_ev_ctx_pop(void);
65 void stat_ev_emit(const char *name, double val);
66 void stat_ev_begin(const char *prefix);
67 void stat_ev_end(void);
68 void stat_ev_flush(void);
72 #endif /* FIRM_STATEVENT_H */