2 * @file firm_timing.c -- timing for the Firm compiler
4 * (C) 2006-2009 Michael Beck beck@ipd.info.uni-karlsruhe.de
6 #include "firm_timing.h"
8 #include <libfirm/adt/xmalloc.h>
10 static int timers_inited;
12 typedef struct timer_info_t {
13 struct timer_info_t *next;
18 static timer_info_t *infos;
19 static timer_info_t *last_info;
21 void timer_register(ir_timer_t *timer, const char *description)
23 timer_info_t *info = XMALLOCZ(timer_info_t);
25 info->description = xstrdup(description);
28 if (last_info != NULL) {
29 last_info->next = info;
41 void timer_term(FILE *f)
46 for (info = infos; info != NULL; info = next) {
47 ir_timer_t *timer = info->timer;
49 double val = (double)ir_timer_elapsed_usec(timer) / 1000.0;
50 const char *description = info->description;
51 fprintf(f, "%-45s %8.3f msec\n", description, val);
55 xfree(info->description);
65 void timer_push(ir_timer_t *timer)
71 void timer_pop(ir_timer_t *timer)
77 void timer_start(ir_timer_t *timer)
80 ir_timer_start(timer);
83 void timer_stop(ir_timer_t *timer)