[google] Remove deprecated pfmon-specific functions/structs from pmu-profile.c (issue6442086)
Removes references in libgcov.c to functions and structs removed from pmu-profile.c For google/main. Tested with crosstools and bootstrap. 2012-08-07 Chris Manghane * libgcc/pmu-profile.c (enum pmu_tool_type): Remove pfmon-specific functions/structs. (enum pmu_event_type): Ditto. (enum pmu_state): Ditto. (enum cpu_vendor_signature): Ditto. (struct pmu_tool_info): Ditto. (void gcov_write_branch_mispredict_infos): Ditto. (get_x86cpu_vendor): Ditto. (parse_pmu_profile_options): Ditto. (start_addr2line_symbolizer): Ditto. (reset_symbolizer_parent_pipes): Ditto. (reset_symbolizer_child_pipes): Ditto. (end_addr2line_symbolizer): Ditto. (symbolize_addr2line): Ditto. (start_pfmon_module): Ditto. (convert_pct_to_unsigned): Ditto. (parse_load_latency_line): Ditto. (parse_branch_mispredict_line): Ditto. (parse_pfmon_load_latency): Ditto. (parse_pfmon_tool_header): Ditto. (parse_pfmon_branch_mispredicts): Ditto. (pmu_start): Ditto. (init_pmu_branch_mispredict): Ditto. (init_pmu_tool): Ditto. (__gcov_init_pmu_profiler): Ditto. (__gcov_start_pmu_profiler): Ditto. (__gcov_stop_pmu_profiler): Ditto. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_load_latency_infos): Ditto. (gcov_write_branch_mispredict_infos): Ditto. (gcov_write_tool_header): Ditto. (__gcov_end_pmu_profiler): Ditto. * libgcc/libgcov.c (gcov_alloc_filename): Remove references to pfmon specific functions/structs. (pmu_profile_stop): Ditto. (gcov_exit): Ditto. (__gcov_init): Ditto. (__gcov_flush): Ditto. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190135) +++ libgcc/pmu-profile.c(working copy) @@ -67,169 +67,11 @@ see the files COPYING3 and COPYING.RUNTIME respect #define XDELETEVEC(p) free(p) #define XDELETE(p) free(p) -#define PFMON_CMD "/usr/bin/pfmon" -#define ADDR2LINE_CMD "/usr/bin/addr2line" -#define PMU_TOOL_MAX_ARGS (20) -static char default_addr2line[] = "??:0"; -static const char pfmon_ll_header[] = "# counts %self%cum " -"<10 <32 <64<256 <1024 >=1024 %wself " -"code addr symbol\n"; -static const char pfmon_bm_header[] = -"# counts %self%cum code addr symbol\n"; - -const char *pfmon_intel_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--smpl-module=pebs-ll", - "--ld-lat-threshold=4", - "--pebs-ll-dcmiss-code", - "--resolve-addresses", - "-emem_inst_retired:LATENCY_ABOVE_THRESHOLD", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "-uk", - "--with-header", - "--smpl-module=ibs", - "--resolve-addresses", - "-eibsop_event:uops", - "--ibs-dcmiss-code", - "--long-smpl-periods=0x0", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_intel_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eMISPREDICTED_BRANCH_RETIRED", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eRETIRED_MISPREDICTED_BRANCH_INSTRUCTIONS", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *addr2line_args[PMU_TOOL_MAX_ARGS] = { - ADDR2LINE_CMD, - "-e", - 0 /* terminating NULL must be present */ -}; - - -enum pmu_tool_type -{ - PTT_PFMON, - PTT_LAST -}; - -enum pmu_event_type -{ - PET_INTEL_LOAD_LATENCY, - PET_AMD_LOAD_LATENCY, - PET_INTEL_BRANCH_MISPREDICT, - PET_AMD_BRANCH_MISPREDICT, - PET_LAST -}; - -typedef struct pmu_tool_fns { - const char *name; /* name of the pmu tool */ - /* pmu tool commandline argument. */ - const char **arg_array; - /* Initialize pmu module. */ - void *(*init_pmu_module) (void); - /* Start profililing. */ - void (*start_pmu_module) (pid_t ppid, char *tmpfile, const char **args); - /* Stop profililing. */ - void (*stop_pmu_module) (void); - /* How to parse the ou
[google] Modification of gcov pmu format to reduce gcda size bloat (issue6427063)
This patch has been updated to reflect changes in patch r190247, which removed pfmon support. The patch should be applied to google/main Tested with crosstools. 2012-08-14 Chris Manghane * libgcc/pmu-profile.c (gcov_write_load_latency_infos): Removed unused function. (gcov_write_branch_mispredict_infos): Ditto. (destroy_load_latency_infos): Removed static keyword. (init_pmu_branch_mispredict): Ditto. (gcov_write_ll_line): Ditto, plus replaced filename field with filetag. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_string_table_entry): New function. (gcov_write_tool_header): Removed static keyword. * gcc/gcov.c (release_structures): Removed filename field from PMU structures. (filter_pmu_data_lines): Added PMU string table support. (process_pmu_profile): Ditto. * gcc/gcov-io.c (gcov_read_pmu_load_latency_info): Replaced filename field with filetag. (gcov_read_pmu_branch_mispredict_info): Ditto. (gcov_read_pmu_string_table_entry): New Function. (print_load_latency_line): Replaced filename field with filetag. (print_branch_mispredict_line): Ditto. (print_string_table_entry): New function. * gcc/gcov-io.h (GCOV_TAG_PMU_LOAD_LATENCY_LENGTH): Replaced filename field with filetag (GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH): Ditto. (GCOV_TAG_PMU_STRING_TABLE_ENTRY): Added new tag. (GCOV_TAG_PMU_STRING_TABLE_ENTRY_LENGTH): Ditto. (gcov_pmu_load_latency_info): Replaced filename field with filetag. (gcov_pmu_branch_mispredict_info): Ditto. (gcov_pmu_string_table_entry): New struct. (gcov_pmu_string_table): New struct. * gcc/gcov-dump.c (tag_pmu_load_latency_info): Removed PMU filename field. (tag_pmu_branch_mispredict_info): Ditto. (tag_pmu_string_table_entry): New function. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190362) +++ libgcc/pmu-profile.c(working copy) @@ -1,3 +1,4 @@ + /* Performance monitoring unit (PMU) profiler. If available, use an external tool to collect hardware performance counter data and write it in the .gcda files. @@ -74,13 +75,13 @@ static void destroy_load_latency_infos (void *info static void destroy_branch_mispredict_infos (void *info); static gcov_unsigned_t gcov_tag_pmu_tool_header_length (gcov_pmu_tool_header_t *header); -static void gcov_write_tool_header (gcov_pmu_tool_header_t *header); -static void gcov_write_load_latency_infos (void *info); -static void gcov_write_branch_mispredict_infos (void *info); -static void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); -static void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t +void gcov_write_tool_header (gcov_pmu_tool_header_t *header); +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info); +void gcov_write_string_table_entry (const gcov_pmu_st_entry_t *st_entry); + /* Convert a fractional PCT to an unsigned integer after muliplying by 100. */ @@ -156,11 +157,11 @@ init_pmu_branch_mispredict (void) /* Write the load latency information LL_INFO into the gcda file. */ -static void +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_LOAD_LATENCY_LENGTH (ll_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, + GCOV_TAG_PMU_LOAD_LATENCY_LENGTH()); gcov_write_unsigned (ll_info->counts); gcov_write_unsigned (ll_info->self); gcov_write_unsigned (ll_info->cum); @@ -174,27 +175,38 @@ gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_i gcov_write_counter (ll_info->code_addr); gcov_write_unsigned (ll_info->line); gcov_write_unsigned (ll_info->discriminator); - gcov_write_string (ll_info->filename); + gcov_write_unsigned (ll_info->filetag); } /* Write the branch mispredict information BRM_INFO into the gcda file. */ -static void +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH ( - brm_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, + GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH()); gcov_write_unsigned (brm_info->counts); gcov_write_unsigned (brm_info->self); gcov_write_unsigned (brm_info->cum); gcov_write_counter (brm_info->code_addr); gcov_write_unsigned (brm_inf
[google] Modification of gcov pmu format to reduce gcda size bloat (issue6427063)
Fixed formatting issues. The patch should be applied to google/main Tested with crosstools. 2012-08-24 Chris Manghane * libgcc/pmu-profile.c (gcov_write_load_latency_infos): Removed unused function. (gcov_write_branch_mispredict_infos): Ditto. (destroy_load_latency_infos): Removed static keyword. (init_pmu_branch_mispredict): Ditto. (gcov_write_ll_line): Ditto, plus replaced filename field with filetag. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_string_table_entry): New function. (gcov_write_tool_header): Removed static keyword. * gcc/gcov.c (release_structures): Removed filename field from PMU structures. (filter_pmu_data_lines): Added PMU string table support. (process_pmu_profile): Ditto. * gcc/gcov-io.c (gcov_read_pmu_load_latency_info): Replaced filename field with filetag. (gcov_read_pmu_branch_mispredict_info): Ditto. (gcov_read_pmu_string_table_entry): New Function. (print_load_latency_line): Replaced filename field with filetag. (print_branch_mispredict_line): Ditto. (print_string_table_entry): New function. * gcc/gcov-io.h (GCOV_TAG_PMU_LOAD_LATENCY_LENGTH): Replaced filename field with filetag (GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH): Ditto. (GCOV_TAG_PMU_STRING_TABLE_ENTRY): Added new tag. (GCOV_TAG_PMU_STRING_TABLE_ENTRY_LENGTH): Ditto. (gcov_pmu_load_latency_info): Replaced filename field with filetag. (gcov_pmu_branch_mispredict_info): Ditto. (gcov_pmu_string_table_entry): New struct. (gcov_pmu_string_table): New struct. * gcc/gcov-dump.c (tag_pmu_load_latency_info): Removed PMU filename field. (tag_pmu_branch_mispredict_info): Ditto. (tag_pmu_string_table_entry): New function. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190362) +++ libgcc/pmu-profile.c(working copy) @@ -1,3 +1,4 @@ + /* Performance monitoring unit (PMU) profiler. If available, use an external tool to collect hardware performance counter data and write it in the .gcda files. @@ -74,13 +75,13 @@ static void destroy_load_latency_infos (void *info static void destroy_branch_mispredict_infos (void *info); static gcov_unsigned_t gcov_tag_pmu_tool_header_length (gcov_pmu_tool_header_t *header); -static void gcov_write_tool_header (gcov_pmu_tool_header_t *header); -static void gcov_write_load_latency_infos (void *info); -static void gcov_write_branch_mispredict_infos (void *info); -static void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); -static void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t +void gcov_write_tool_header (gcov_pmu_tool_header_t *header); +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info); +void gcov_write_string_table_entry (const gcov_pmu_st_entry_t *st_entry); + /* Convert a fractional PCT to an unsigned integer after muliplying by 100. */ @@ -156,11 +157,11 @@ init_pmu_branch_mispredict (void) /* Write the load latency information LL_INFO into the gcda file. */ -static void +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_LOAD_LATENCY_LENGTH (ll_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, + GCOV_TAG_PMU_LOAD_LATENCY_LENGTH()); gcov_write_unsigned (ll_info->counts); gcov_write_unsigned (ll_info->self); gcov_write_unsigned (ll_info->cum); @@ -174,27 +175,38 @@ gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_i gcov_write_counter (ll_info->code_addr); gcov_write_unsigned (ll_info->line); gcov_write_unsigned (ll_info->discriminator); - gcov_write_string (ll_info->filename); + gcov_write_unsigned (ll_info->filetag); } /* Write the branch mispredict information BRM_INFO into the gcda file. */ -static void +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH ( - brm_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, + GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH()); gcov_write_unsigned (brm_info->counts); gcov_write_unsigned (brm_info->self); gcov_write_unsigned (brm_info->cum); gcov_write_counter (brm_info->code_addr); gcov_write_unsigned (brm_info->line); gcov_write_unsigned (brm_info->discriminator); - gcov_write_str
[google] Modification of gcov pmu format to reduce gcda size bloat (issue6427063)
Moved pmu writing utilities to global header. The patch should be applied to google/main Tested with crosstools. 2012-08-27 Chris Manghane * libgcc/pmu-profile.c (gcov_write_load_latency_infos): Removed unused function. (gcov_write_branch_mispredict_infos): Ditto. (destroy_load_latency_infos): Removed static keyword. (init_pmu_branch_mispredict): Ditto. (gcov_write_ll_line): Ditto, plus replaced filename field with filetag. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_string_table_entry): New function. (gcov_write_tool_header): Removed static keyword. * gcc/gcov.c (release_structures): Removed filename field from PMU structures. (filter_pmu_data_lines): Added PMU string table support. (process_pmu_profile): Ditto. * gcc/gcov-io.c (gcov_read_pmu_load_latency_info): Replaced filename field with filetag. (gcov_read_pmu_branch_mispredict_info): Ditto. (gcov_read_pmu_string_table_entry): New Function. (print_load_latency_line): Replaced filename field with filetag. (print_branch_mispredict_line): Ditto. (print_string_table_entry): New function. * gcc/gcov-io.h (GCOV_TAG_PMU_LOAD_LATENCY_LENGTH): Replaced filename field with filetag (GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH): Ditto. (GCOV_TAG_PMU_STRING_TABLE_ENTRY): Added new tag. (GCOV_TAG_PMU_STRING_TABLE_ENTRY_LENGTH): Ditto. (gcov_pmu_load_latency_info): Replaced filename field with filetag. (gcov_pmu_branch_mispredict_info): Ditto. (gcov_pmu_string_table_entry): New struct. (gcov_pmu_string_table): New struct. (gcov_write_ll_line): Moved pmu writing utilities to global header. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_string_table_entry): Ditto. (gcov_write_tool_header): Ditto. * gcc/gcov-dump.c (tag_pmu_load_latency_info): Removed PMU filename field. (tag_pmu_branch_mispredict_info): Ditto. (tag_pmu_string_table_entry): New function. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190362) +++ libgcc/pmu-profile.c(working copy) @@ -1,3 +1,4 @@ + /* Performance monitoring unit (PMU) profiler. If available, use an external tool to collect hardware performance counter data and write it in the .gcda files. @@ -74,12 +75,6 @@ static void destroy_load_latency_infos (void *info static void destroy_branch_mispredict_infos (void *info); static gcov_unsigned_t gcov_tag_pmu_tool_header_length (gcov_pmu_tool_header_t *header); -static void gcov_write_tool_header (gcov_pmu_tool_header_t *header); -static void gcov_write_load_latency_infos (void *info); -static void gcov_write_branch_mispredict_infos (void *info); -static void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); -static void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t - *brm_info); /* Convert a fractional PCT to an unsigned integer after muliplying by 100. */ @@ -156,11 +151,11 @@ init_pmu_branch_mispredict (void) /* Write the load latency information LL_INFO into the gcda file. */ -static void +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_LOAD_LATENCY_LENGTH (ll_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_LOAD_LATENCY_INFO, + GCOV_TAG_PMU_LOAD_LATENCY_LENGTH()); gcov_write_unsigned (ll_info->counts); gcov_write_unsigned (ll_info->self); gcov_write_unsigned (ll_info->cum); @@ -174,27 +169,38 @@ gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_i gcov_write_counter (ll_info->code_addr); gcov_write_unsigned (ll_info->line); gcov_write_unsigned (ll_info->discriminator); - gcov_write_string (ll_info->filename); + gcov_write_unsigned (ll_info->filetag); } /* Write the branch mispredict information BRM_INFO into the gcda file. */ -static void +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info) { - gcov_unsigned_t len = GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH ( - brm_info->filename); - gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, len); + gcov_write_tag_length (GCOV_TAG_PMU_BRANCH_MISPREDICT_INFO, + GCOV_TAG_PMU_BRANCH_MISPREDICT_LENGTH()); gcov_write_unsigned (brm_info->counts); gcov_write_unsigned (brm_info->self); gcov_write_unsigned (brm_info->cum); gcov_write_counter (brm_info->code_addr); gcov_write_unsigned (brm_info->line); gcov_write_unsigned (brm_info->discriminator); - gcov_write_string (brm_info->f
[google] Added new dump flag -pmu to display pmu data in pass summaries (issue6489092)
This patch adds a new dump flag that dumps PMU profile information using the -pmu dump option. This patch should be applied to google/main. Tested with crosstools. 2012-09-06 Chris Manghane * gcc/doc/invoke.texi: Modified pmu-profile-use option. * gcc/tree-dump.c: Added new dump flag. * gcc/tree-pretty-print.c (dump_load_latency_details): New function. (dump_pmu): New function. (dump_generic_node): Added support for new dump flag. * gcc/tree-pretty-print.h: Added new function to global header. * gcc/tree-pass.h (enum tree_dump_index): Added new dump flag. * gcc/gcov.c: (process_pmu_profile): Fixed assertion conditions. * gcc/gcov-io.h (struct gcov_pmu_summary): Added new struct. * gcc/opts.c (common_handle_option): Added support for modified option. * gcc/gimple-pretty-print.c (dump_gimple_phi): Added support for new dump flag. (dump_gimple_stmt): Ditto. * gcc/coverage.c (htab_counts_entry_hash): Added new hash table for PMU info. (htab_pmu_entry_hash): Ditto. (htab_counts_entry_eq): Ditto. (htab_pmu_entry_eq): Ditto. (htab_counts_entry_del): Ditto. (htab_pmu_entry_del): Ditto. (read_counts_file): Ditto. (static void read_pmu_file): Ditto. (get_coverage_pmu_latency): Ditto. (get_coverage_pmu_branch_mispredict): Ditto. (pmu_data_present): Added new function. (coverage_init): Added pmu file reading support. * gcc/coverage.h: Added pmu functions to global header. * gcc/common.opt: Modified pmu-profile-use option. Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi (revision 190817) +++ gcc/doc/invoke.texi (working copy) @@ -399,7 +399,7 @@ Objective-C and Objective-C++ Dialects}. -fprofile-generate=@var{path} -fprofile-generate-sampling @gol -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol -fpmu-profile-generate=@var{pmuoption} @gol --fpmu-profile-use=@var{pmuoption} @gol +-fpmu-profile-use=@var{pmudata} @gol -freciprocal-math -free -fregmove -frename-registers -freorder-blocks @gol -frecord-gcc-switches-in-elf@gol -freorder-blocks-and-partition -freorder-functions @gol @@ -8381,12 +8381,11 @@ displayed using coverage tool gcov. The params var "pmu_profile_n_addresses" can be used to restrict PMU data collection to only this many addresses. -@item -fpmu-profile-use=@var{pmuoption} +@item -fpmu-profile-use=@var{pmudata} @opindex fpmu-profile-use -Enable performance monitoring unit (PMU) profiling based -optimizations. Currently only @var{load-latency} and -@var{branch-mispredict} are supported. +If @var{pmudata} is specified, GCC will read PMU data from @var{pmudata}. If +unspecified, PMU data will be read from 'pmuprofile.gcda'. @item -fprofile-strip=@var{base_suffix} @opindex fprofile-strip Index: gcc/tree-dump.c === --- gcc/tree-dump.c (revision 190817) +++ gcc/tree-dump.c (working copy) @@ -824,9 +824,11 @@ static const struct dump_option_value_info dump_op {"nouid", TDF_NOUID}, {"enumerate_locals", TDF_ENUMERATE_LOCALS}, {"scev", TDF_SCEV}, + {"pmu", TDF_PMU}, {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE - | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV)}, + | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV +| TDF_PMU)}, {NULL, 0} }; Index: gcc/tree-pretty-print.c === --- gcc/tree-pretty-print.c (revision 190817) +++ gcc/tree-pretty-print.c (working copy) @@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "output.h" +#include "basic-block.h" +#include "gcov-io.h" +#include "coverage.h" #include "tree-pretty-print.h" #include "hashtab.h" #include "tree-flow.h" @@ -51,6 +54,7 @@ static void do_niy (pretty_printer *, const_tree); static pretty_printer buffer; static int initialized = 0; +static char *file_prefix = NULL; /* Try to print something for an unknown tree code. */ @@ -461,7 +465,32 @@ dump_omp_clauses (pretty_printer *buffer, tree cla } } +/* Dump detailed information about pmu load latency events */ +void +dump_load_latency_details (pretty_printer *buffer, gcov_pmu_ll_info_t *ll_info) +{ + if (ll_info == NULL) +return; + + pp_string (buffer, "\n[load latency contribution: "); + pp_scalar (buffer, "%.2f%%\n", ll_info->self / 100.f); + pp_string (buffer, "average cycle
[google] Added new dump flag -pmu to display pmu data in pass summaries (issue6489092)
Fixed spacing and condensed repeated code into helper. This patch should be applied to google/main. Tested with crosstools. 2012-09-06 Chris Manghane * gcc/doc/invoke.texi: Modified pmu-profile-use option. * gcc/tree-dump.c: Added new dump flag. * gcc/tree-pretty-print.c (dump_load_latency_details): New function. (dump_pmu): New function. (dump_generic_node): Added support for new dump flag. * gcc/tree-pretty-print.h: Added new function to global header. * gcc/tree-pass.h (enum tree_dump_index): Added new dump flag. * gcc/gcov.c: (process_pmu_profile): Fixed assertion conditions. * gcc/gcov-io.h (struct gcov_pmu_summary): Added new struct. * gcc/opts.c (common_handle_option): Added support for modified option. * gcc/gimple-pretty-print.c (dump_pmu_data): New function. (dump_gimple_phi): Added support for new dump flag. (dump_gimple_stmt): Ditto. * gcc/coverage.c (htab_counts_entry_hash): Added new hash table for PMU info. (htab_pmu_entry_hash): Ditto. (htab_counts_entry_eq): Ditto. (htab_pmu_entry_eq): Ditto. (htab_counts_entry_del): Ditto. (htab_pmu_entry_del): Ditto. (read_counts_file): Ditto. (static void read_pmu_file): Ditto. (get_coverage_pmu_latency): Ditto. (get_coverage_pmu_branch_mispredict): Ditto. (pmu_data_present): Added new function. (coverage_init): Added pmu file reading support. * gcc/coverage.h: Added pmu functions to global header. * gcc/common.opt: Modified pmu-profile-use option. Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi (revision 190817) +++ gcc/doc/invoke.texi (working copy) @@ -399,7 +399,7 @@ Objective-C and Objective-C++ Dialects}. -fprofile-generate=@var{path} -fprofile-generate-sampling @gol -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol -fpmu-profile-generate=@var{pmuoption} @gol --fpmu-profile-use=@var{pmuoption} @gol +-fpmu-profile-use=@var{pmudata} @gol -freciprocal-math -free -fregmove -frename-registers -freorder-blocks @gol -frecord-gcc-switches-in-elf@gol -freorder-blocks-and-partition -freorder-functions @gol @@ -8381,12 +8381,11 @@ displayed using coverage tool gcov. The params var "pmu_profile_n_addresses" can be used to restrict PMU data collection to only this many addresses. -@item -fpmu-profile-use=@var{pmuoption} +@item -fpmu-profile-use=@var{pmudata} @opindex fpmu-profile-use -Enable performance monitoring unit (PMU) profiling based -optimizations. Currently only @var{load-latency} and -@var{branch-mispredict} are supported. +If @var{pmudata} is specified, GCC will read PMU data from @var{pmudata}. If +unspecified, PMU data will be read from 'pmuprofile.gcda'. @item -fprofile-strip=@var{base_suffix} @opindex fprofile-strip Index: gcc/tree-dump.c === --- gcc/tree-dump.c (revision 190817) +++ gcc/tree-dump.c (working copy) @@ -824,9 +824,11 @@ static const struct dump_option_value_info dump_op {"nouid", TDF_NOUID}, {"enumerate_locals", TDF_ENUMERATE_LOCALS}, {"scev", TDF_SCEV}, + {"pmu", TDF_PMU}, {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE - | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV)}, + | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV +| TDF_PMU)}, {NULL, 0} }; Index: gcc/tree-pretty-print.c === --- gcc/tree-pretty-print.c (revision 190817) +++ gcc/tree-pretty-print.c (working copy) @@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "output.h" +#include "basic-block.h" +#include "gcov-io.h" +#include "coverage.h" #include "tree-pretty-print.h" #include "hashtab.h" #include "tree-flow.h" @@ -51,6 +54,7 @@ static void do_niy (pretty_printer *, const_tree); static pretty_printer buffer; static int initialized = 0; +static char *file_prefix = NULL; /* Try to print something for an unknown tree code. */ @@ -461,7 +465,32 @@ dump_omp_clauses (pretty_printer *buffer, tree cla } } +/* Dump detailed information about pmu load latency events */ +void +dump_load_latency_details (pretty_printer *buffer, gcov_pmu_ll_info_t *ll_info) +{ + if (ll_info == NULL) +return; + + pp_string (buffer, "\n[load latency contribution: "); + pp_scalar (buffer, "%.2f%%\n", ll_info->self / 100.f); + pp_string (buffer, "average cycle
[google] Modification of gcov pmu format to reduce gcda size bloat (issue6427063)
This patch modifies pmu-profile to allow gooda_feedback access to important gcov to gcda conversion functions and also modifies the gcov pmu format store indices in a string table of filenames as opposed to storing the filename inside of every pmu entry. This reduces the amount of size bloat in gcda, especially since the gcda files do a per asm line analysis and this leads to many entries sharing the same filename data anyways. gooda_feedback considers this and outputs the string following the load latency and branch misprediction information. The changes made belong to one of the following categories: 1. Removing static declaration/defition of certain function that are needed by gooda_feedback (pmu-profile.c) 2. Modifying the gcov format to use indices instead of string for the filename (gcov-io.h) 3. Modifying gcda writing functions to write the index instead of the filename (pmu-profile.c) 4. Removing references to filename (gcov-io.c, pmu-profile.c) This was tested by using crosstool-validate with --testers=crosstool. No other testcases seemed necessary since this patch only modifies data that is relevant to pfmon, which is considered dead now. The patch should be applied to google/gcc-4_7 The CL for gooda_feedback can be found at Google ref c/31972005 2012-07-24 Chris Manghane * libgcc/pmu-profile.c (static int parse_pfmon_load_latency): filename field no longer exists (parse_load_latency_line): filename field no longer exists (parse_branch_mispredict_line): filename field no longer exists (__gcov_stop_pmu_profiler): filename field no longer exists (gcov_write_ll_line): now writes string table index instead of filename (gcov_write_branch_mispredict_line): now writes string table index instead of filename (gcov_write_load_latency_infos): filename field no longer exists (gcov_write_branch_mispredict_infos): filename field no longer exists (gcov_tag_pmu_tool_header_length): filename field no longer exists (gcov_write_tool_header): filename field no longer exists * gcc/gcov.c (release_structures): filename field no longer exists (filter_pmu_data_lines): filename field no longer exists * gcc/gcov-io.c (gcov_read_pmu_load_latency_info): removed filename field and added string table index (gcov_read_pmu_branch_mispredict_info): removed filename field and added string table index (print_load_latency_line): filename field no longer exists (print_branch_mispredict_line): filename field no longer exists * gcc/gcov-io.h: added new tag for string table printing * gcc/gcov-dump.c (tag_pmu_load_latency_info): filename field no longer exists (tag_pmu_branch_mispredict_info): filename field no longer exists Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 189823) +++ libgcc/pmu-profile.c(working copy) @@ -232,11 +232,11 @@ static int parse_pfmon_load_latency (char *filenam static int parse_pfmon_branch_mispredicts (char *filename, void *pmu_data); static gcov_unsigned_t gcov_tag_pmu_tool_header_length (gcov_pmu_tool_header_t *header); -static void gcov_write_tool_header (gcov_pmu_tool_header_t *header); -static void gcov_write_load_latency_infos (void *info); -static void gcov_write_branch_mispredict_infos (void *info); -static void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); -static void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t +void gcov_write_tool_header (gcov_pmu_tool_header_t *header); +void gcov_write_load_latency_infos (void *info); +void gcov_write_branch_mispredict_infos (void *info); +void gcov_write_ll_line (const gcov_pmu_ll_info_t *ll_info); +void gcov_write_branch_mispredict_line (const gcov_pmu_brm_info_t *brm_info); static int start_addr2line_symbolizer (pid_t pid); static void end_addr2line_symbolizer (void); @@ -749,14 +749,12 @@ parse_load_latency_line (char *line, gcov_pmu_ll_i if (!sep) { /* Assume entire string is srcfile. */ - ll_info->filename = (char *)sym_info; ll_info->line = 0; } else { /* Terminate the filename string at the separator. */ *sep = 0; - ll_info->filename = (char *)sym_info; /* Convert rest of the sym info to a line number. */ ll_info->line = atol (sep+1); } @@ -765,7 +763,6 @@ parse_load_latency_line (char *line, gcov_pmu_ll_i else { /* No symbolizer available. */ - ll_info->filename = NULL; ll_info->line = 0; ll_info->discriminator = 0; } @@ -815,14 +812,12 @@ parse_branch_mispredict_line (char *line, gcov_pmu if (!sep) { /* As
[google] Remove deprecated pfmon-specific functions/structs from pmu-profile.c (issue6442086)
This patch removes functions and structs necessary for gathering pmu info with pfmon, which is now a deprecated tool. For google/main. Tested with bootstrap. 2012-08-03 Chris Manghane * libgcc/pmu-profile.c (enum pmu_tool_type): Remove pfmon-specific functions/strucs. (enum pmu_event_type): Ditto. (enum pmu_state): Ditto. (enum cpu_vendor_signature): Ditto. (struct pmu_tool_info): Ditto. (static void gcov_write_branch_mispredict_infos): Ditto. (get_x86cpu_vendor): Ditto. (parse_pmu_profile_options): Ditto. (start_addr2line_symbolizer): Ditto. (reset_symbolizer_parent_pipes): Ditto. (reset_symbolizer_child_pipes): Ditto. (end_addr2line_symbolizer): Ditto. (symbolize_addr2line): Ditto. (start_pfmon_module): Ditto. (convert_pct_to_unsigned): Ditto. (parse_load_latency_line): Ditto. (parse_branch_mispredict_line): Ditto. (parse_pfmon_load_latency): Ditto. (parse_pfmon_tool_header): Ditto. (parse_pfmon_branch_mispredicts): Ditto. (pmu_start): Ditto. (init_pmu_branch_mispredict): Ditto. (init_pmu_tool): Ditto. (__gcov_init_pmu_profiler): Ditto. (__gcov_start_pmu_profiler): Ditto. (__gcov_stop_pmu_profiler): Ditto. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_load_latency_infos): Ditto. (gcov_write_branch_mispredict_infos): Ditto. (gcov_write_tool_header): Ditto. (__gcov_end_pmu_profiler): Ditto. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190103) +++ libgcc/pmu-profile.c(working copy) @@ -67,169 +67,11 @@ see the files COPYING3 and COPYING.RUNTIME respect #define XDELETEVEC(p) free(p) #define XDELETE(p) free(p) -#define PFMON_CMD "/usr/bin/pfmon" -#define ADDR2LINE_CMD "/usr/bin/addr2line" -#define PMU_TOOL_MAX_ARGS (20) -static char default_addr2line[] = "??:0"; -static const char pfmon_ll_header[] = "# counts %self%cum " -"<10 <32 <64<256 <1024 >=1024 %wself " -"code addr symbol\n"; -static const char pfmon_bm_header[] = -"# counts %self%cum code addr symbol\n"; - -const char *pfmon_intel_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--smpl-module=pebs-ll", - "--ld-lat-threshold=4", - "--pebs-ll-dcmiss-code", - "--resolve-addresses", - "-emem_inst_retired:LATENCY_ABOVE_THRESHOLD", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "-uk", - "--with-header", - "--smpl-module=ibs", - "--resolve-addresses", - "-eibsop_event:uops", - "--ibs-dcmiss-code", - "--long-smpl-periods=0x0", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_intel_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eMISPREDICTED_BRANCH_RETIRED", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eRETIRED_MISPREDICTED_BRANCH_INSTRUCTIONS", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *addr2line_args[PMU_TOOL_MAX_ARGS] = { - ADDR2LINE_CMD, - "-e", - 0 /* terminating NULL must be present */ -}; - - -enum pmu_tool_type -{ - PTT_PFMON, - PTT_LAST -}; - -enum pmu_event_type -{ - PET_INTEL_LOAD_LATENCY, - PET_AMD_LOAD_LATENCY, - PET_INTEL_BRANCH_MISPREDICT, - PET_AMD_BRANCH_MISPREDICT, - PET_LAST -}; - -typedef struct pmu_tool_fns { - const char *name; /* name of the pmu tool */ - /* pmu tool commandline argument. */ - const char **arg_array; - /* Initialize pmu module. */ - void *(*init_pmu_module) (void); - /* Start profililing. */ - void (*start_pmu_module) (pid_t ppid, char *tmpfile, const char **args); - /* Stop profililing. */ - void (*stop_pmu_module) (void); - /* How to parse the output generated by the PMU tool. */ - int (*parse_pmu_output) (char *filename, void *pmu_data); - /* How to write parsed pmu data into gcda file. */ - void (*gcov_write_pmu_data) (void *data); - /* How to cleanup any
Changed strucs to structs. (issue6442086)
This patch removes functions and structs necessary for gathering pmu info with pfmon, which is now a deprecated tool. For google/main. Tested with bootstrap. 2012-08-03 Chris Manghane * libgcc/pmu-profile.c (enum pmu_tool_type): Remove pfmon-specific functions/structs. (enum pmu_event_type): Ditto. (enum pmu_state): Ditto. (enum cpu_vendor_signature): Ditto. (struct pmu_tool_info): Ditto. (void gcov_write_branch_mispredict_infos): Ditto. (get_x86cpu_vendor): Ditto. (parse_pmu_profile_options): Ditto. (start_addr2line_symbolizer): Ditto. (reset_symbolizer_parent_pipes): Ditto. (reset_symbolizer_child_pipes): Ditto. (end_addr2line_symbolizer): Ditto. (symbolize_addr2line): Ditto. (start_pfmon_module): Ditto. (convert_pct_to_unsigned): Ditto. (parse_load_latency_line): Ditto. (parse_branch_mispredict_line): Ditto. (parse_pfmon_load_latency): Ditto. (parse_pfmon_tool_header): Ditto. (parse_pfmon_branch_mispredicts): Ditto. (pmu_start): Ditto. (init_pmu_branch_mispredict): Ditto. (init_pmu_tool): Ditto. (__gcov_init_pmu_profiler): Ditto. (__gcov_start_pmu_profiler): Ditto. (__gcov_stop_pmu_profiler): Ditto. (gcov_write_branch_mispredict_line): Ditto. (gcov_write_load_latency_infos): Ditto. (gcov_write_branch_mispredict_infos): Ditto. (gcov_write_tool_header): Ditto. (__gcov_end_pmu_profiler): Ditto. Index: libgcc/pmu-profile.c === --- libgcc/pmu-profile.c(revision 190103) +++ libgcc/pmu-profile.c(working copy) @@ -67,169 +67,11 @@ see the files COPYING3 and COPYING.RUNTIME respect #define XDELETEVEC(p) free(p) #define XDELETE(p) free(p) -#define PFMON_CMD "/usr/bin/pfmon" -#define ADDR2LINE_CMD "/usr/bin/addr2line" -#define PMU_TOOL_MAX_ARGS (20) -static char default_addr2line[] = "??:0"; -static const char pfmon_ll_header[] = "# counts %self%cum " -"<10 <32 <64<256 <1024 >=1024 %wself " -"code addr symbol\n"; -static const char pfmon_bm_header[] = -"# counts %self%cum code addr symbol\n"; - -const char *pfmon_intel_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--smpl-module=pebs-ll", - "--ld-lat-threshold=4", - "--pebs-ll-dcmiss-code", - "--resolve-addresses", - "-emem_inst_retired:LATENCY_ABOVE_THRESHOLD", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_ll_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "-uk", - "--with-header", - "--smpl-module=ibs", - "--resolve-addresses", - "-eibsop_event:uops", - "--ibs-dcmiss-code", - "--long-smpl-periods=0x0", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_intel_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eMISPREDICTED_BRANCH_RETIRED", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *pfmon_amd_brm_args[PMU_TOOL_MAX_ARGS] = { - PFMON_CMD, - "--aggregate-results", - "--follow-all", - "--with-header", - "--resolve-addresses", - "-eRETIRED_MISPREDICTED_BRANCH_INSTRUCTIONS", - "--long-smpl-periods=1", - 0 /* terminating NULL must be present */ -}; - -const char *addr2line_args[PMU_TOOL_MAX_ARGS] = { - ADDR2LINE_CMD, - "-e", - 0 /* terminating NULL must be present */ -}; - - -enum pmu_tool_type -{ - PTT_PFMON, - PTT_LAST -}; - -enum pmu_event_type -{ - PET_INTEL_LOAD_LATENCY, - PET_AMD_LOAD_LATENCY, - PET_INTEL_BRANCH_MISPREDICT, - PET_AMD_BRANCH_MISPREDICT, - PET_LAST -}; - -typedef struct pmu_tool_fns { - const char *name; /* name of the pmu tool */ - /* pmu tool commandline argument. */ - const char **arg_array; - /* Initialize pmu module. */ - void *(*init_pmu_module) (void); - /* Start profililing. */ - void (*start_pmu_module) (pid_t ppid, char *tmpfile, const char **args); - /* Stop profililing. */ - void (*stop_pmu_module) (void); - /* How to parse the output generated by the PMU tool. */ - int (*parse_pmu_output) (char *filename, void *pmu_data); - /* How to write parsed pmu data into gcda file. */ - void (*gcov_write_pmu_data) (void *data); - /* How to cleanup any