2 * @file firm_timing.c -- timing for the Firm compiler
4 * (C) 2006-2009 Michael Beck beck@ipd.info.uni-karlsruhe.de
8 #include <libfirm/timing.h>
9 #include "firm_timing.h"
11 static const char *tv_names[] = {
12 #define DEFTIMEVAR(x, y, z) y,
13 #include "firm_timing.def"
18 static const char *tv_desc[] = {
19 #define DEFTIMEVAR(x, y, z) z,
20 #include "firm_timing.def"
25 static ir_timer_t *timers[TV_LAST];
26 static int timers_inited;
28 void timer_init(void) {
31 for (i = 0; i < TV_LAST; ++i) {
32 timers[i] = ir_timer_register(tv_names[i], tv_desc[i]);
38 void timer_term(FILE *f) {
41 for (i = 0; i < TV_LAST; ++i) {
42 double val = (double)ir_timer_elapsed_usec(timers[i]) / 1000.0;
43 fprintf(f, "%-30s %8.3f msec\n", tv_desc[i], val);
49 void timer_push(int timer) {
51 ir_timer_push(timers[timer]);
54 void timer_pop(void) {
59 void timer_start(int timer) {
61 ir_timer_start(timers[timer]);
64 void timer_stop(int timer) {
66 ir_timer_stop(timers[timer]);