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_cnt_decl(var)
34 #define stat_ev_cnt_inc(var)
35 #define stat_ev_cnt_done(name, var)
38 #define stat_ev_ctx_push_fobj(key, firm_object)
39 #define stat_ev_ctx_push(key, value)
40 #define stat_ev_ctx_pop()
41 #define stat_ev_begin(prefix, blub)
46 extern int stat_ev_enabled;
48 #define stat_ev_do(expr) (stat_ev_enabled ? ((expr), 1) : 0)
50 #define stat_ev_dbl(name, val) if (stat_ev_enabled) { stat_ev_emit(name, val); }
52 #define stat_ev_cnt_decl(var) int stat_ev_cnt_var_ ## var = 0
53 #define stat_ev_cnt_inc(var) (void) ++stat_ev_cnt_var_ ## var
54 #define stat_ev_cnt_done(var, name) stat_ev_dbl((name), stat_ev_cnt_var_ ## var)
56 #define stat_ev(name) stat_ev_dbl((name), 0.0)
58 void stat_ev_ctx_push_fobj(const char *key, const void *firm_object);
59 void stat_ev_ctx_push(const char *key, const char *value);
60 void stat_ev_ctx_pop(void);
61 void stat_ev_emit(const char *name, double val);
62 void stat_ev_begin(const char *prefix);
63 void stat_ev_end(void);
67 #endif /* FIRM_STATEVENT_H */