also output total backend time to statfile
authorMatthias Braun <matze@braunis.de>
Tue, 24 Oct 2006 20:23:56 +0000 (20:23 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 24 Oct 2006 20:23:56 +0000 (20:23 +0000)
ir/be/bechordal_main.c
ir/be/bemain.c
ir/be/bestat.c
ir/be/bestat.h

index 3fec2fe..6868ff4 100644 (file)
@@ -578,9 +578,8 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
                chordal_env.border_heads  = pmap_create();
                chordal_env.ignore_colors = bitset_malloc(chordal_env.cls->n_regs);
 
-               be_stat_tags[STAT_TAG_CLS] = chordal_env.cls->name;
-
                if(be_stat_ev_is_active()) {
+                       be_stat_tags[STAT_TAG_CLS] = chordal_env.cls->name;
                        be_stat_ev_push(be_stat_tags, STAT_TAG_LAST, be_stat_file);
 
                        /* perform some node statistics. */
index 7535e58..18ab7b3 100644 (file)
@@ -30,6 +30,7 @@
 #include "irloop_t.h"
 #include "irtools.h"
 #include "irvrfy.h"
+#include "irprintf.h"
 #include "return.h"
 #include "firmstat.h"
 #include "cfopt.h"
@@ -497,11 +498,16 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
                ir_graph *irg  = birg->irg;
                optimization_state_t state;
                const arch_code_generator_if_t *cg_if;
+               char irg_name[128];
 
                /* set the current graph (this is important for several firm functions) */
                current_ir_graph = irg;
 
-               be_init_stat_file(be_options.stat_file_name, irg);
+               if(be_stat_ev_is_active()) {
+                       ir_snprintf(irg_name, sizeof(irg_name), "%F", irg);
+                       be_stat_tags[STAT_TAG_IRG] = irg_name;
+                       be_stat_ev_push(be_stat_tags, STAT_TAG_LAST, be_stat_file);
+               }
 
                /* stop and reset timers */
                BE_TIMER_ONLY(
@@ -747,7 +753,9 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
                if (! stat_is_active())
                        free_ir_graph(irg);
 
-               be_close_stat_file();
+               if(be_stat_ev_is_active()) {
+                       be_stat_ev_pop();
+               }
        }
        be_profile_free();
        be_done_env(&env);
@@ -782,20 +790,29 @@ void be_main(FILE *file_handle, const char *cup_name)
 
                lc_timer_reset_and_start(t);
        }
+
+       be_init_stat_file(be_options.stat_file_name, cup_name);
 #endif /* WITH_LIBCORE */
 
        /* never build code for pseudo irgs */
        set_visit_pseudo_irgs(0);
 
        be_node_init();
+
        be_main_loop(file_handle, cup_name);
 
 #ifdef WITH_LIBCORE
        if (be_options.timing == BE_TIME_ON) {
                lc_timer_stop(t);
                lc_timer_leave_high_priority();
-               printf("%-20s: %lu msec\n", "BEMAINLOOP", lc_timer_elapsed_msec(t));
+               if(be_stat_ev_is_active()) {
+                       be_stat_ev_l("backend_time", lc_timer_elapsed_msec(t));
+               } else {
+                       printf("%-20s: %lu msec\n", "BEMAINLOOP", lc_timer_elapsed_msec(t));
+               }
        }
+
+       be_close_stat_file();
 #endif /* WITH_LIBCORE */
 }
 
index 486fad8..996f8a6 100644 (file)
@@ -307,11 +307,9 @@ const char *be_stat_tags[STAT_TAG_LAST];
 
 FILE *be_stat_file = NULL;
 
-void be_init_stat_file(const char *stat_file_name, ir_graph *irg)
+void be_init_stat_file(const char *stat_file_name, const char *sourcefilename)
 {
-       unsigned line;
        static char time_str[32];
-       static char irg_name[128];
 
        assert(be_stat_file == NULL);
 
@@ -327,11 +325,10 @@ void be_init_stat_file(const char *stat_file_name, ir_graph *irg)
 
        /* initialize the statistics tags */
        ir_snprintf(time_str, sizeof(time_str),"%u", time(NULL));
-       ir_snprintf(irg_name, sizeof(irg_name), "%F", irg);
 
-       be_stat_tags[STAT_TAG_FILE] = be_retrieve_dbg_info(get_entity_dbg_info(get_irg_entity(irg)), &line);
+       be_stat_tags[STAT_TAG_FILE] = sourcefilename;
        be_stat_tags[STAT_TAG_TIME] = time_str;
-       be_stat_tags[STAT_TAG_IRG]  = irg_name;
+       be_stat_tags[STAT_TAG_IRG]  = "<all>";
        be_stat_tags[STAT_TAG_CLS]  = "<all>";
 
        be_stat_ev_push(be_stat_tags, STAT_TAG_LAST, be_stat_file);
index 3ca4d1a..961ee2f 100644 (file)
@@ -76,7 +76,7 @@ void be_do_stat_nodes(ir_graph *irg, const char *phase);
  */
 void be_stat_init_irg(const arch_env_t *arch_env, ir_graph *irg);
 
-void be_init_stat_file(const char *filename, ir_graph *irg);
+void be_init_stat_file(const char *filename, const char *sourcefilename);
 void be_close_stat_file(void);
 
 #else