]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Print statistics devel/icpp2021
authorGiuliano Belinassi <giuliano.belinassi@usp.br>
Wed, 9 Jun 2021 13:48:16 +0000 (10:48 -0300)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Wed, 9 Jun 2021 13:48:16 +0000 (10:48 -0300)
gcc/cgraphunit.c
gcc/langhooks.c
gcc/lto-partition.c
gcc/toplev.c

index 12d2d19e944eb1d9818f9c316ce0ecad0cd50194..7e01c9d8a61755f03959fae067d3d19bd4948706 100644 (file)
@@ -2782,6 +2782,8 @@ static bool is_number (const char *str)
 
 static int childno = -1;
 
+void print_partitions_statistics ();
+
 static bool
 maybe_compile_in_parallel (void)
 {
@@ -2800,6 +2802,10 @@ maybe_compile_in_parallel (void)
   if (!flag_parallel_jobs || !split_outputs)
     return false;
 
+
+  struct timeval start, end;
+  gettimeofday(&start, NULL);
+
   FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (cnode)
     {
       ipa_size_summary *ss = ipa_size_summaries->get (cnode);
@@ -2869,6 +2875,10 @@ maybe_compile_in_parallel (void)
       return false;
     }
 
+
+  //print_partitions_statistics();
+  //exit(0);
+
   /* Find out statics that need to be promoted
      to globals with hidden visibility because they are accessed from
      multiple partitions.  */
@@ -2902,6 +2912,16 @@ maybe_compile_in_parallel (void)
       jobserver_return_token ('p');
     }
 
+
+  gettimeofday(&end, NULL);
+
+  long seconds = (end.tv_sec - start.tv_sec);
+  long micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+
+  printf("Partitioner: %ld.%06ld\n", seconds, micros);
+
+  gettimeofday(&start, NULL);
+
   /* Spawn processes.  Spawn as soon as there is a free slot.  */
   for (j = 0, i = -num_jobs; i < partitions; i++, j++)
     {
@@ -2942,6 +2962,14 @@ maybe_compile_in_parallel (void)
      now.  */
   if (jobserver)
     jobserver_get_token ();
+
+
+  gettimeofday(&end, NULL);
+
+  seconds = (end.tv_sec - start.tv_sec);
+  micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+
+  printf("LTRANS: %ld.%06ld\n", seconds, micros);
   exit (0);
 }
 
@@ -2951,6 +2979,9 @@ maybe_compile_in_parallel (void)
 void
 symbol_table::compile (void)
 {
+  struct timeval start, end;
+  long seconds, micros;
+
   if (seen_error ())
     return;
 
@@ -2970,8 +3001,18 @@ symbol_table::compile (void)
   /* Don't run the IPA passes if there was any error or sorry messages.  */
   if (!seen_error ())
   {
+
     timevar_start (TV_CGRAPH_IPA_PASSES);
+
+    gettimeofday(&start, NULL);
     ipa_passes ();
+    gettimeofday(&end, NULL);
+
+    seconds = (end.tv_sec - start.tv_sec);
+    micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+
+    printf("IPA: %ld.%06ld micros\n", seconds, micros);
+
     maybe_compile_in_parallel ();
     timevar_stop (TV_CGRAPH_IPA_PASSES);
   }
@@ -2984,6 +3025,9 @@ symbol_table::compile (void)
       return;
     }
 
+
+  gettimeofday(&start, NULL);
+
   global_info_ready = true;
   if (dump_file)
     {
@@ -3051,6 +3095,13 @@ symbol_table::compile (void)
   state = FINISHED;
   output_weakrefs ();
 
+  gettimeofday(&end, NULL);
+
+  seconds = (end.tv_sec - start.tv_sec);
+  micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+
+  printf("Intraprocedural: %ld.%06ld\n", seconds, micros);
+
   if (dump_file)
     {
       fprintf (dump_file, "\nFinal ");
index 3cbe04c6899ae72468c4a89c2391a15e0b83c8fe..f9d6e6f09836fdd0a8937ffd1a4eae8cda09ed6d 100644 (file)
@@ -304,6 +304,7 @@ global_decl_processing (void)
   tree globals, decl, *vec;
   int len, i;
 
+
   timevar_stop (TV_PHASE_PARSING);
   timevar_start (TV_PHASE_DEFERRED);
   /* Really define vars that have had only a tentative definition.
index d70ee2b2b780831d734a5aba0e9b9743708ce76a..51a9946aa652b5ad203c4a7a4996146d3a2cc6f9 100644 (file)
@@ -376,6 +376,43 @@ lto_max_map (void)
     new_partition ("empty");
 }
 
+void print_partitions_statistics()
+{
+  int n_partitions = ltrans_partitions.length();
+  int i;
+
+  printf ("Number of partitions: %d\n", n_partitions);
+
+  for (i = 0; i < n_partitions; i++)
+    {
+      ltrans_partition part = ltrans_partitions[i];
+      printf ("Partition: %d, Nr of insns: %d, Symbols: %d\n", i, part->insns,
+             part->symbols);
+
+      lto_symtab_encoder_iterator lsei;
+      lto_symtab_encoder_t encoder = part->encoder;
+
+      for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei))
+       {
+         if (cgraph_node *cnode = dyn_cast<cgraph_node *>(lsei_node (lsei)))
+           {
+             if (cnode->get_partitioning_class () == SYMBOL_PARTITION)
+               {
+                 ipa_size_summary *summary = ipa_size_summaries->get (cnode);
+                 if (summary)
+                   printf ("  Node id: %d, name: %s, insns: %d\n", cnode->order, cnode->name (), summary->size);      
+               }
+             /*
+             else 
+               printf ("  Node: %s, Boundary\n", cnode->name ());      
+               */
+           }
+       }
+    }
+
+  fflush (stdout);
+}
+
 /* Class implementing a union-find algorithm.  */
 
 class union_find
@@ -488,7 +525,6 @@ balance_partitions (union_find *ds, int n, int jobs)
          ipa_size_summary *summary = ipa_size_summaries->get (cnode);
          if (summary)
            {
-             printf("%s; %d\n", cnode->name (), summary->size);
              sizes[root] += summary->size;
            }
          else
index 95450880aab8c4f1ce7748a94f3ee19397448380..314bdcdd955b1b9896f0c51e753b88c53c39f745 100644 (file)
@@ -456,9 +456,19 @@ compile_file (void)
   timevar_start (TV_PHASE_PARSING);
   timevar_push (TV_PARSE_GLOBAL);
 
+  struct timeval start, end;
+
+  gettimeofday(&start, NULL);
   /* Parse entire file and generate initial debug information.  */
   lang_hooks.parse_file ();
 
+  gettimeofday(&end, NULL);
+
+  long seconds = (end.tv_sec - start.tv_sec);
+  long micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+
+  printf("Parsing: %ld.%06ld\n", seconds, micros);
+
   timevar_pop (TV_PARSE_GLOBAL);
   timevar_stop (TV_PHASE_PARSING);