From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2100) id 7441E387087B; Sat, 22 Aug 2020 23:29:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7441E387087B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598138991; bh=/CQGTZ2vcvmG08xdRdAI5Rd8tYkGVTpbNJ1NrJHYQf8=; h=From:To:Subject:Date:From; b=MdTzOacNBCfbOawPmYf/MvAPXjquXw5sVacVJpZkIAd1ATOthS2hHy6JGVaxbq55x cK7iZUmlKkXXqkaRVGYklrnujCt20bdlt4XxxvPKtvUeuSMUinVndG2yfIYybpl77t 1q9GbJlXXtvmv8h4xpSTpAqDdX6VEws5V+fde1Ho= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Giuliano Belinassi To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/autopar_devel] Add -fdump-profile-report. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/devel/autopar_devel X-Git-Oldrev: 5e426dfbcd98b5a3a61a168baf88282e764261f3 X-Git-Newrev: 797da60343b0382ed055da8880b87d36d02e5c27 Message-Id: <20200822232951.7441E387087B@sourceware.org> Date: Sat, 22 Aug 2020 23:29:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2020 23:29:51 -0000 https://gcc.gnu.org/g:797da60343b0382ed055da8880b87d36d02e5c27 commit 797da60343b0382ed055da8880b87d36d02e5c27 Author: Martin Liska Date: Thu Jul 9 11:58:11 2020 +0200 Add -fdump-profile-report. When using -fprofile-report, -fdump-profile-report can be used to print the report to a foo.c.000i.profile-report file instead of stderr. I see it handy for comparison purpose. gcc/ChangeLog: * dumpfile.c [profile-report]: Add new profile dump. * dumpfile.h (enum tree_dump_index): Ad TDI_profile_report. * passes.c (pass_manager::dump_profile_report): Change stderr to dump_file. Diff: --- gcc/dumpfile.c | 3 ++- gcc/dumpfile.h | 1 + gcc/passes.c | 47 +++++++++++++++++++++++++++-------------------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 5d61946fc49..9a5496a18e8 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -103,8 +103,9 @@ static struct dump_file_info dump_files[TDI_end] = DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0), DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0), DUMP_FILE_INFO (".lto-stream-out", "ipa-lto-stream-out", DK_ipa, 0), + DUMP_FILE_INFO (".profile-report", "profile-report", DK_ipa, 0), #define FIRST_AUTO_NUMBERED_DUMP 1 -#define FIRST_ME_AUTO_NUMBERED_DUMP 4 +#define FIRST_ME_AUTO_NUMBERED_DUMP 5 DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0), DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0), diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 00e175a4737..ee9e602b67f 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -48,6 +48,7 @@ enum tree_dump_index TDI_gimple, /* dump each function after gimplifying it */ TDI_nested, /* dump each function after unnesting it */ TDI_lto_stream_out, /* dump information about lto streaming */ + TDI_profile_report, /* dump information about profile quality */ TDI_lang_all, /* enable all the language dumps. */ TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ diff --git a/gcc/passes.c b/gcc/passes.c index 07b2613ffea..a5da9a46f4e 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1850,10 +1850,15 @@ pass_manager::dump_profile_report () const if (!profile_record) return; - fprintf (stderr, "\nProfile consistency report:\n\n"); - fprintf (stderr, " |mismatch |mismatch | |\n"); - fprintf (stderr, "Pass name |IN |IN |OUT |OUT |overall |\n"); - fprintf (stderr, " |freq |count |freq |count |size |time |\n"); + + FILE *dump_file = dump_begin (TDI_profile_report, NULL); + if (dump_file == NULL) + dump_file = stderr; + + fprintf (dump_file, "Profile consistency report:\n\n"); + fprintf (dump_file, " |mismatch |mismatch | |\n"); + fprintf (dump_file, "Pass name |IN |IN |OUT |OUT |overall |\n"); + fprintf (dump_file, " |freq |count |freq |count |size |time |\n"); for (int i = 1; i < passes_by_id_size; i++) if (profile_record[i].run) @@ -1876,47 +1881,47 @@ pass_manager::dump_profile_report () const || rel_time_change || rel_size_change) { last_reported = i; - fprintf (stderr, "%-33s", passes_by_id[i]->name); + fprintf (dump_file, "%-33s", passes_by_id[i]->name); if (profile_record[i].num_mismatched_freq_in != last_freq_in) - fprintf (stderr, "| %+5i", + fprintf (dump_file, "| %+5i", profile_record[i].num_mismatched_freq_in - last_freq_in); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); if (profile_record[i].num_mismatched_count_in != last_count_in) - fprintf (stderr, "| %+5i", + fprintf (dump_file, "| %+5i", profile_record[i].num_mismatched_count_in - last_count_in); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); if (profile_record[i].num_mismatched_freq_out != last_freq_out) - fprintf (stderr, "| %+5i", + fprintf (dump_file, "| %+5i", profile_record[i].num_mismatched_freq_out - last_freq_out); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); if (profile_record[i].num_mismatched_count_out != last_count_out) - fprintf (stderr, "| %+5i", + fprintf (dump_file, "| %+5i", profile_record[i].num_mismatched_count_out - last_count_out); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); /* Size/time units change across gimple and RTL. */ if (i == pass_expand_1->static_pass_number) - fprintf (stderr, "|----------|----------"); + fprintf (dump_file, "|----------|----------"); else { if (rel_size_change) - fprintf (stderr, "| %+8.1f%%", rel_size_change); + fprintf (dump_file, "| %+8.1f%%", rel_size_change); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); if (rel_time_change) - fprintf (stderr, "| %+8.1f%%", rel_time_change); + fprintf (dump_file, "| %+8.1f%%", rel_time_change); else - fprintf (stderr, "| "); + fprintf (dump_file, "| "); } - fprintf (stderr, "|\n"); + fprintf (dump_file, "|\n"); last_freq_in = profile_record[i].num_mismatched_freq_in; last_freq_out = profile_record[i].num_mismatched_freq_out; last_count_in = profile_record[i].num_mismatched_count_in; @@ -1925,12 +1930,14 @@ pass_manager::dump_profile_report () const else if (last_reported != i) { last_reported = i; - fprintf (stderr, "%-20s ------------| | | | | | |\n", + fprintf (dump_file, "%-20s ------------| | | | | | |\n", passes_by_id[i]->name); } last_time = profile_record[i].time; last_size = profile_record[i].size; } + + dump_end (TDI_profile_report, dump_file); } /* Perform all TODO actions that ought to be done on each function. */