aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-07-07 23:06:33 +0200
committerJan Hubicka <jh@suse.cz>2023-07-07 23:06:33 +0200
commit3cce8d98f270f48f480046d439c9d4635641c24e (patch)
treea154616a5dda515d64548274ad2240267d6b962e
parentba8d3e566787b40e3a91fd259da19c7b59aa4c0f (diff)
downloadgcc-3cce8d98f270f48f480046d439c9d4635641c24e.zip
gcc-3cce8d98f270f48f480046d439c9d4635641c24e.tar.gz
gcc-3cce8d98f270f48f480046d439c9d4635641c24e.tar.bz2
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.
-rw-r--r--gcc/profile-count.cc14
-rw-r--r--gcc/profile-count.h4
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc
index 1658504..6bf9700 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 4270793..99416d9 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;