From: Jan Hubicka Date: Fri, 7 Jul 2023 21:06:33 +0000 (+0200) Subject: Dump profile_count along with relative frequency X-Git-Tag: basepoints/gcc-15~7750 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cce8d98f270f48f480046d439c9d4635641c24e;p=thirdparty%2Fgcc.git Dump profile_count along with relative frequency gcc/ChangeLog: * profile-count.cc (profile_count::dump): Add FUN parameter; print relative frequency. (profile_count::debug): Update. * profile-count.h (profile_count::dump): Update prototype. --- diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc index 16585045f8ea..6bf9700d8db6 100644 --- a/gcc/profile-count.cc +++ b/gcc/profile-count.cc @@ -87,10 +87,16 @@ const char *profile_quality_display_names[] = /* Dump THIS to BUFFER. */ void -profile_count::dump (char *buffer) const +profile_count::dump (char *buffer, struct function *fun) const { if (!initialized_p ()) sprintf (buffer, "uninitialized"); + else if (fun && initialized_p () + && fun->cfg + && ENTRY_BLOCK_PTR_FOR_FN (fun)->count.initialized_p ()) + sprintf (buffer, "%" PRId64 " (%s freq %.4f)", m_val, + profile_quality_display_names[m_quality], + to_sreal_scale (ENTRY_BLOCK_PTR_FOR_FN (fun)->count).to_double ()); else sprintf (buffer, "%" PRId64 " (%s)", m_val, profile_quality_display_names[m_quality]); @@ -99,10 +105,10 @@ profile_count::dump (char *buffer) const /* Dump THIS to F. */ void -profile_count::dump (FILE *f) const +profile_count::dump (FILE *f, struct function *fun) const { char buffer[64]; - dump (buffer); + dump (buffer, fun); fputs (buffer, f); } @@ -111,7 +117,7 @@ profile_count::dump (FILE *f) const void profile_count::debug () const { - dump (stderr); + dump (stderr, cfun); fprintf (stderr, "\n"); } diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 4270793c9f6a..99416d9a4634 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -1281,10 +1281,10 @@ public: sreal to_sreal_scale (profile_count in, bool *known = NULL) const; /* Output THIS to F. */ - void dump (FILE *f) const; + void dump (FILE *f, struct function *fun = NULL) const; /* Output THIS to BUFFER. */ - void dump (char *buffer) const; + void dump (char *buffer, struct function *fun = NULL) const; /* Print THIS to stderr. */ void debug () const;