summaryrefslogtreecommitdiff
path: root/gcc/gcov-dump.c
diff options
context:
space:
mode:
authortejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-04 21:16:18 +0000
committertejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-04 21:16:18 +0000
commit2c2093b3418aad36fde08088dc79fb109993ebec (patch)
treec9108c2ac0250e06b19698c7d374c820ed352432 /gcc/gcov-dump.c
parent6e75e3f2d7035ba70c3c928ae648c9945de34431 (diff)
downloadgcc-2c2093b3418aad36fde08088dc79fb109993ebec.tar.gz
Enhances the gcov program summary by adding a histogram of arc counter
entries. This is used to compute working set information in the compiler for use by optimizations that need information on hot vs cold counter values or the rough working set size in terms of the number of counters. Each working set data point is the minimum counter value and number of counters required to reach a given percentage of the cumulative counter sum across the profiled execution (sum_all in the program summary). 2012-09-04 Teresa Johnson <tejohnson@google.com> * libgcc/libgcov.c (struct gcov_summary_buffer): New structure. (gcov_histogram_insert): New function. (gcov_compute_histogram): Ditto. (gcov_exit): Invoke gcov_compute_histogram, and perform merging of histograms during summary merging. * gcc/gcov-io.c (gcov_write_summary): Write out non-zero histogram entries to function summary along with an occupancy bit vector. (gcov_read_summary): Read in the histogram entries. (gcov_histo_index): New function. (void gcov_histogram_merge): Ditto. * gcc/gcov-io.h (gcov_type_unsigned): New type. (struct gcov_bucket_type): Ditto. (struct gcov_ctr_summary): Include histogram. (GCOV_TAG_SUMMARY_LENGTH): Update to include histogram entries. (GCOV_HISTOGRAM_SIZE): New macro. (GCOV_HISTOGRAM_BITVECTOR_SIZE): Ditto. * gcc/profile.c (NUM_GCOV_WORKING_SETS): Ditto. (gcov_working_sets): New global variable. (compute_working_sets): New function. (find_working_set): Ditto. (get_exec_counts): Invoke compute_working_sets. * gcc/coverage.c (read_counts_file): Merge histograms, and fix bug with accessing summary info for non-summable counters. * gcc/basic-block.h (gcov_type_unsigned): New type. (struct gcov_working_set_info): Ditto. (find_working_set): Declare. * gcc/gcov-dump.c (tag_summary): Dump out histogram. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190952 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-dump.c')
-rw-r--r--gcc/gcov-dump.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c
index 59b8380f299..fb01108946c 100644
--- a/gcc/gcov-dump.c
+++ b/gcc/gcov-dump.c
@@ -447,7 +447,8 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED,
unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED)
{
struct gcov_summary summary;
- unsigned ix;
+ unsigned ix, h_ix;
+ gcov_bucket_type *histo_bucket;
gcov_read_summary (&summary);
printf (" checksum=0x%08x", summary.checksum);
@@ -465,5 +466,24 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED,
(HOST_WIDEST_INT)summary.ctrs[ix].run_max);
printf (", sum_max=" HOST_WIDEST_INT_PRINT_DEC,
(HOST_WIDEST_INT)summary.ctrs[ix].sum_max);
+ if (ix != GCOV_COUNTER_ARCS)
+ continue;
+ printf ("\n");
+ print_prefix (filename, 0, 0);
+ printf ("\t\tcounter histogram:");
+ for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
+ {
+ histo_bucket = &summary.ctrs[ix].histogram[h_ix];
+ if (!histo_bucket->num_counters)
+ continue;
+ printf ("\n");
+ print_prefix (filename, 0, 0);
+ printf ("\t\t%d: num counts=%u, min counter="
+ HOST_WIDEST_INT_PRINT_DEC ", cum_counter="
+ HOST_WIDEST_INT_PRINT_DEC,
+ h_ix, histo_bucket->num_counters,
+ (HOST_WIDEST_INT)histo_bucket->min_value,
+ (HOST_WIDEST_INT)histo_bucket->cum_value);
+ }
}
}