Fix summary generation with fork

Jan Hubicka hubicka@ucw.cz
Tue Nov 19 05:03:00 GMT 2013


> Hi,
> this patch fixes problem we noticed with Martin Liska where gcov_dump is called
> several times per execution of firefox (on each fork and exec).  This causes
> runs to be large and makes functions executed once per program to be considered
> cold.
> 
> This patch makes us to update runs just once per execution and not on each
> streaming of profile data.  While testing it I also noticed that program
> summary is now broken, since crc32 is accumulated per each dumping instead just
> once.
> 
> I believe the newly introduced static vars should go - there is nothing really
> preventing us from doing two concurent updates and also it just unnecesary
> increases to footprint of libgcov.  I converted thus all_prg and crc32 back to
> local vars.
> 
> Bootstrapped/regtested x86_64-linux, comitted.
> 
> 	* libgcov-driver.c (get_gcov_dump_complete): Update comments.
> 	(all_prg, crc32): Remove static vars.
> 	(gcov_exit_compute_summary): Rewrite to return crc32; do not clear
> 	all_prg.
> 	(gcov_exit_merge_gcda): Add crc32 parameter.
> 	(gcov_exit_merge_summary): Add crc32 and all_prg parameter;
> 	do not account run if it was already accounted.
> 	(gcov_exit_dump_gcov): Add crc32 and all_prg parameters.
> 	(gcov_exit): Initialize all_prg; update.

Hi,
it seems I forgot the following hunk in my tree.  With fork we now get
errors about corrupted profile info: run_max * runs < sum_max.
Obviously problem here is again about definition what is run and what
is maximum per run.  I think run_max is quite pointless part of our summary
so I think I will drop it, but first I need to look into the histogram code.

I apologize for the breakage.

Honza

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 204984)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2013-11-18  Jan Hubicka  <jh@suse.cz>
+
+	* profile.c (compute_branch_probabilities): Do not sanity check run_max.
+
 2013-11-18  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* cgraphunit.c (ipa_passes): Don't execute all_lto_gen_passes.
Index: profile.c
===================================================================
--- profile.c	(revision 204984)
+++ profile.c	(working copy)
@@ -528,11 +528,6 @@ compute_branch_probabilities (unsigned c
   /* Very simple sanity checks so we catch bugs in our profiling code.  */
   if (!profile_info)
     return;
-  if (profile_info->run_max * profile_info->runs < profile_info->sum_max)
-    {
-      error ("corrupted profile info: run_max * runs < sum_max");
-      exec_counts = NULL;
-    }
 
   if (profile_info->sum_all < profile_info->sum_max)
     {



More information about the Gcc-patches mailing list