diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-11 23:21:02 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-11 23:21:02 +0000 |
commit | 38fe12e377baa6c8dfe5845687e7ed3d1daf0769 (patch) | |
tree | 91cab9d80f43cc346699b11a23a3f3458b7ab15e /gcc/profile.c | |
parent | 7ec6ec03e2dc34882d54168b08a50b482d640540 (diff) |
Time profiler introduced.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204690 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r-- | gcc/profile.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/gcc/profile.c b/gcc/profile.c index 7118ac8ac29..9e50560830e 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "cfgloop.h" #include "dumpfile.h" +#include "cgraph.h" #include "profile.h" @@ -188,6 +189,15 @@ instrument_values (histogram_values values) gimple_gen_ior_profiler (hist, t, 0); break; + case HIST_TYPE_TIME_PROFILE: + { + basic_block bb = split_edge (single_succ_edge (ENTRY_BLOCK_PTR)); + gimple_stmt_iterator gsi = gsi_start_bb (bb); + + gimple_gen_time_profiler (t, 0, gsi); + break; + } + default: gcc_unreachable (); } @@ -850,6 +860,7 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, gcov_type *histogram_counts[GCOV_N_VALUE_COUNTERS]; gcov_type *act_count[GCOV_N_VALUE_COUNTERS]; gcov_type *aact_count; + struct cgraph_node *node; for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++) n_histogram_counters[t] = 0; @@ -888,6 +899,7 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, t = (int) hist->type; aact_count = act_count[t]; + if (act_count[t]) act_count[t] += hist->n_counters; @@ -895,9 +907,22 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, hist->hvalue.counters = XNEWVEC (gcov_type, hist->n_counters); for (j = 0; j < hist->n_counters; j++) if (aact_count) - hist->hvalue.counters[j] = aact_count[j]; - else - hist->hvalue.counters[j] = 0; + hist->hvalue.counters[j] = aact_count[j]; + else + hist->hvalue.counters[j] = 0; + + /* Time profiler counter is not related to any statement, + so that we have to read the counter and set the value to + the corresponding call graph node. */ + if (hist->type == HIST_TYPE_TIME_PROFILE) + { + node = cgraph_get_node (hist->fun->decl); + + node->tp_first_run = hist->hvalue.counters[0]; + + if (dump_file) + fprintf (dump_file, "Read tp_first_run: %d\n", node->tp_first_run); + } } for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++) |