2 * @file firm_timing.c -- timing for the Firm compiler
4 * (C) 2006 Michael Beck beck@ipd.info.uni-karlsruhe.de
8 #include <libcore/lc_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 lc_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] = lc_timer_register(tv_names[i], tv_desc[i]);
38 void timer_term(FILE *f) {
41 for (i = 0; i < TV_LAST; ++i) {
42 unsigned long val = lc_timer_elapsed_msec(timers[i]);
43 fprintf(f, "%-30s %8lu\n", tv_desc[i], val);
49 void timer_push(int timer) {
51 lc_timer_push(timers[timer]);
54 void timer_pop(void) {
59 void timer_start(int timer) {
61 lc_timer_start(timers[timer]);
64 void timer_stop(int timer) {
66 lc_timer_stop(timers[timer]);