Commit 6f2df337 authored by Matthias Braun's avatar Matthias Braun
Browse files

make statev API public

parent b4b6a3c3
......@@ -46,6 +46,7 @@ libfirminclude_HEADERS = \
lowering.h \
nodeops.h \
opcodes.h \
statev.h \
timing.h \
trouts.h \
tv.h \
......
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the
* packaging of this file.
*
* Licensees holding valid libFirm Professional Edition licenses may use
* this file in accordance with the libFirm Commercial License.
* Agreement provided with the Software.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE.
*/
/**
* @file
* @brief Statistic events.
* @author Sebastian Hack
*/
#ifndef FIRM_STATEVENT_H
#define FIRM_STATEVENT_H
/**
* @defgroup statev Statistic Events
*
* The statistics system helps to evaluate the effects of compiler passes and
* transformations. It is typically used to collect information like the number
* of instruction before and behind a pass, counting specific patterns or
* measuring the timing of subcomponents. This can create quite a bit of data,
* so we provide a framework for producing such data in an organzied way and
* some external tools to analyse such data.
*
* The system is based on 2 concepts: Events and Contexts. A statistic-event is
* a pair of an event name and a double value. Events are put into a context
* like the compilation unit, the currently compiled function or the currently
* allocated register class. So contexts refine events and allow a grouping of
* events based on their context later. The context is managed in an
* hierarchic manner. You can push key/value pairs to refine the previous
* context or pop them again to get back to the previous broader context.
*
* @{
*/
/** Pushes a new setting on the context stack. */
FIRM_API void stat_ev_ctx_push_fmt(const char *key, const char *fmt, ...);
/** Pushes a new setting with a string value on the context stack. */
FIRM_API void stat_ev_ctx_push_str(const char *key, const char *str);
/** Pops last setting from context stack. */
FIRM_API void stat_ev_ctx_pop(const char *key);
/** Emits a statistic event with a double value. */
FIRM_API void stat_ev_dbl(const char *name, double value);
/** Emits a statistic event with an integer value. */
FIRM_API void stat_ev_int(const char *name, int value);
/** Emits a statistic event with an unsigned long long value. */
FIRM_API void stat_ev_ull(const char *name, unsigned long long value);
/** Emits a statistic event (without an additional value). */
FIRM_API void stat_ev(const char *name);
/**
* Initialize the stat ev machinery.
* @param filename_prefix The prefix of the filename (.ev or .ev.gz will be
* appended).
* @param filter All pushes, pops and events will be filtered by this.
* If we have regex support, you can give an extended
* regex here. If not, each key will be matched against
* this. Matched means, we look if the key starts with
* @p filter. If NULL is given, each key passes, ie
* the filter is always TRUE.
*/
FIRM_API void stat_ev_begin(const char *filename_prefix, const char *filter);
/**
* Shuts down stat ev machinery
*/
FIRM_API void stat_ev_end(void);
/**
* This variable indicates whether statev output is enabled.
*/
FIRM_API int stat_ev_enabled;
/** @} */
#endif
......@@ -387,7 +387,7 @@ EXTRA_DIST = \
stat/pattern_dmp.h \
stat/stat_dmp.h \
stat/stat_timing.h \
stat/statev.h \
stat/statev_t.h \
tr/compound_path_t.h \
tr/entity_t.h \
tr/tpop_t.h \
......
......@@ -35,7 +35,7 @@
#include "irprintf.h"
#include "irdom_t.h"
#include "set.h"
#include "statev.h"
#include "statev_t.h"
#include "dfs_t.h"
#include "util.h"
......
......@@ -35,7 +35,7 @@
#include "set.h"
#include "hashptr.h"
#include "debug.h"
#include "statev.h"
#include "statev_t.h"
#include "dfs_t.h"
#include "absgraph.h"
......
......@@ -58,7 +58,7 @@
#include "irlivechk.h"
#include "statev.h"
#include "statev_t.h"
typedef struct bl_info_t {
const ir_node *block; /**< The block. */
......
......@@ -54,7 +54,7 @@
#include "beirgmod.h"
#include "beifg.h"
#include "beinsn_t.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "beirg.h"
#include "beintlive_t.h"
#include "bera.h"
......
......@@ -37,7 +37,7 @@
#include "beirgmod.h"
#include "beinsn_t.h"
#include "besched.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "benode.h"
#include "bemodule.h"
#include "belive.h"
......@@ -252,7 +252,7 @@ ir_node *pre_process_constraints(be_chordal_env_t *env, be_insn_t **the_insn)
if (perm == NULL)
return NULL;
be_stat_ev("constr_perm", get_irn_arity(perm));
stat_ev_int("constr_perm", get_irn_arity(perm));
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
arch_set_irn_register(proj, NULL);
......
......@@ -62,7 +62,7 @@
#include "bearch.h"
#include "beifg.h"
#include "benode.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "bestat.h"
#include "bemodule.h"
#include "be_t.h"
......
......@@ -47,7 +47,7 @@
#include "irtools.h"
#include "error.h"
#include "list.h"
#include "statev.h"
#include "statev_t.h"
#include "bearch.h"
#include "beifg.h"
......
......@@ -30,7 +30,7 @@
#include "irtools.h"
#include "irprintf.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "beirg.h"
#include "bemodule.h"
#include "error.h"
......@@ -280,10 +280,10 @@ lpp_sol_state_t ilp_go(ilp_env_t *ienv)
lpp_solve(ienv->lp, be_options.ilp_server, be_options.ilp_solver);
//be_stat_ev_dbl("co_ilp_objval", ienv->lp->objval);
//be_stat_ev_dbl("co_ilp_best_bound", ienv->lp->best_bound);
be_stat_ev ("co_ilp_iter", lpp_get_iter_cnt(ienv->lp));
be_stat_ev_dbl("co_ilp_sol_time", lpp_get_sol_time(ienv->lp));
//stat_ev_dbl("co_ilp_objval", ienv->lp->objval);
//stat_ev_dbl("co_ilp_best_bound", ienv->lp->best_bound);
stat_ev_int("co_ilp_iter", lpp_get_iter_cnt(ienv->lp));
stat_ev_dbl("co_ilp_sol_time", lpp_get_sol_time(ienv->lp));
ienv->apply(ienv);
......
......@@ -59,7 +59,7 @@
#include "bemodule.h"
#include "benode.h"
#include "besched.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "beutil.h"
#include "lc_opts.h"
......@@ -1029,14 +1029,14 @@ void co_driver(be_chordal_env_t *cenv)
co_complete_stats(co, &before);
be_stat_ev_ull("co_aff_nodes", before.aff_nodes);
be_stat_ev_ull("co_aff_edges", before.aff_edges);
be_stat_ev_ull("co_max_costs", before.max_costs);
be_stat_ev_ull("co_inevit_costs", before.inevit_costs);
be_stat_ev_ull("co_aff_int", before.aff_int);
stat_ev_ull("co_aff_nodes", before.aff_nodes);
stat_ev_ull("co_aff_edges", before.aff_edges);
stat_ev_ull("co_max_costs", before.max_costs);
stat_ev_ull("co_inevit_costs", before.inevit_costs);
stat_ev_ull("co_aff_int", before.aff_int);
be_stat_ev_ull("co_init_costs", before.costs);
be_stat_ev_ull("co_init_unsat", before.unsatisfied_edges);
stat_ev_ull("co_init_costs", before.costs);
stat_ev_ull("co_init_unsat", before.unsatisfied_edges);
if (dump_flags & DUMP_BEFORE) {
FILE *f = my_open(cenv, "", "-before.vcg");
......@@ -1053,7 +1053,7 @@ void co_driver(be_chordal_env_t *cenv)
/* do the stats and provide the current costs */
co_complete_stats(co, &stats);
be_stat_ev_ull("co_prepare_costs", stats.costs);
stat_ev_ull("co_prepare_costs", stats.costs);
}
/* perform actual copy minimization */
......@@ -1061,8 +1061,8 @@ void co_driver(be_chordal_env_t *cenv)
was_optimal = selected_copyopt->copyopt(co);
ir_timer_stop(timer);
be_stat_ev("co_time", ir_timer_elapsed_msec(timer));
be_stat_ev_ull("co_optimal", was_optimal);
stat_ev_dbl("co_time", ir_timer_elapsed_msec(timer));
stat_ev_ull("co_optimal", was_optimal);
ir_timer_free(timer);
if (dump_flags & DUMP_AFTER) {
......@@ -1094,8 +1094,8 @@ void co_driver(be_chordal_env_t *cenv)
fclose(f);
}
be_stat_ev_ull("co_after_costs", after.costs);
be_stat_ev_ull("co_after_unsat", after.unsatisfied_edges);
stat_ev_ull("co_after_costs", after.costs);
stat_ev_ull("co_after_unsat", after.unsatisfied_edges);
co_free_graph_structure(co);
co_free_ou_structure(co);
......
......@@ -15,7 +15,7 @@
#include "irgraph_t.h"
#include "iredges_t.h"
#include "statev.h"
#include "statev_t.h"
#include "beirg.h"
#include "besched.h"
......
......@@ -35,7 +35,7 @@
#include "irnodeset.h"
#include "absgraph.h"
#include "statev.h"
#include "statev_t.h"
#include "beutil.h"
#include "belive_t.h"
......
......@@ -32,7 +32,7 @@
#include "irnodehashmap.h"
#include "irhooks.h"
#include "irlivechk.h"
#include "statev.h"
#include "statev_t.h"
#include "pset.h"
#include "bitset.h"
......
......@@ -640,9 +640,9 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
current_ir_graph = irg;
if (stat_ev_enabled) {
stat_ev_ctx_push_fobj("bemain_irg", irg);
be_stat_ev("bemain_insns_start", be_count_insns(irg));
be_stat_ev("bemain_blocks_start", be_count_blocks(irg));
stat_ev_ctx_push_fmt("bemain_irg", "%+F", irg);
stat_ev_ull("bemain_insns_start", be_count_insns(irg));
stat_ev_ull("bemain_blocks_start", be_count_blocks(irg));
}
/* stop and reset timers */
......@@ -757,8 +757,8 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
if (stat_ev_enabled) {
stat_ev_dbl("bemain_costs_before_ra", be_estimate_irg_costs(irg));
be_stat_ev("bemain_insns_before_ra", be_count_insns(irg));
be_stat_ev("bemain_blocks_before_ra", be_count_blocks(irg));
stat_ev_ull("bemain_insns_before_ra", be_count_insns(irg));
stat_ev_ull("bemain_blocks_before_ra", be_count_blocks(irg));
}
/* Do register allocation */
......@@ -776,8 +776,8 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
dump(DUMP_FINAL, irg, "finish");
if (stat_ev_enabled) {
be_stat_ev("bemain_insns_finish", be_count_insns(irg));
be_stat_ev("bemain_blocks_finish", be_count_blocks(irg));
stat_ev_ull("bemain_insns_finish", be_count_insns(irg));
stat_ev_ull("bemain_blocks_finish", be_count_blocks(irg));
}
/* check schedule and register allocation */
......
......@@ -29,7 +29,7 @@
#include "debug.h"
#include "iredges_t.h"
#include "raw_bitset.h"
#include "statev.h"
#include "statev_t.h"
#include "irgwalk.h"
#include "bespill.h"
......
......@@ -41,7 +41,7 @@
#include "bespill.h"
#include "bespillslots.h"
#include "bechordal_t.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "bemodule.h"
#include "beintlive_t.h"
#include "beirg.h"
......
......@@ -53,7 +53,7 @@
#include "belive_t.h"
#include "benode.h"
#include "bechordal_t.h"
#include "bestatevent.h"
#include "statev_t.h"
#include "bessaconstr.h"
#include "beirg.h"
#include "beirgmod.h"
......
......@@ -410,7 +410,7 @@ void be_ssa_construction_init(be_ssa_construction_env_t *env, ir_graph *irg)
ir_node *sb = get_irg_start_block(irg);
int n_blocks = get_Block_dom_max_subtree_pre_num(sb);
stat_ev_ctx_push_fobj("bessaconstr", irg);
stat_ev_ctx_push_fmt("bessaconstr", "%+F", irg);
stat_ev_tim_push();
(void) n_blocks;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment