2 * @file firm_timing.c -- timing for the Firm compiler
4 * (C) 2006-2009 Michael Beck beck@ipd.info.uni-karlsruhe.de
8 #include "firm_timing.h"
10 #include <libfirm/adt/xmalloc.h>
12 static int timers_inited;
14 typedef struct timer_info_t {
15 struct timer_info_t *next;
20 static timer_info_t *infos;
21 static timer_info_t *last_info;
23 void timer_register(ir_timer_t *timer, const char *description)
25 timer_info_t *info = XMALLOCZ(timer_info_t);
27 info->description = xstrdup(description);
30 if (last_info != NULL) {
31 last_info->next = info;
43 void timer_term(FILE *f)
48 for (info = infos; info != NULL; info = next) {
49 ir_timer_t *timer = info->timer;
50 double val = (double)ir_timer_elapsed_usec(timer) / 1000.0;
51 const char *description = info->description;
52 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)
78 void timer_start(ir_timer_t *timer)
81 ir_timer_start(timer);
84 void timer_stop(ir_timer_t *timer)