This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix timevar format and fix tests (PR testsuite/84597).


Hi.

It's fix of 2 tests that I forgot to adjust. Apart from that I'm slightly adjust
printf patterns in order to support '100%' values.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

gcc/ChangeLog:

2018-02-28  Martin Liska  <mliska@suse.cz>

	PR testsuite/84597
	* timevar.c (timer::print): Fix format to properly print 100%
	values.

gcc/testsuite/ChangeLog:

2018-02-28  Martin Liska  <mliska@suse.cz>

	* g++.dg/ext/timevar1.C: Fix pruned patterns.
	* g++.dg/ext/timevar2.C: Likewise.
---
 gcc/testsuite/g++.dg/ext/timevar1.C |  5 ++---
 gcc/testsuite/g++.dg/ext/timevar2.C |  5 ++---
 gcc/timevar.c                       | 16 ++++++++--------
 3 files changed, 12 insertions(+), 14 deletions(-)


diff --git a/gcc/testsuite/g++.dg/ext/timevar1.C b/gcc/testsuite/g++.dg/ext/timevar1.C
index a48f8ba3705..3f891a50aba 100644
--- a/gcc/testsuite/g++.dg/ext/timevar1.C
+++ b/gcc/testsuite/g++.dg/ext/timevar1.C
@@ -1,9 +1,8 @@
 // PR c++/52248
 // { dg-options "-ftime-report" }
 // { dg-allow-blank-lines-in-output 1 }
-// { dg-prune-output "wall" }
-// { dg-prune-output "times" }
-// { dg-prune-output "TOTAL" }
+// { dg-prune-output "Time variable" }
+// { dg-prune-output " kB" }
 // { dg-prune-output "checks" }
 
 void
diff --git a/gcc/testsuite/g++.dg/ext/timevar2.C b/gcc/testsuite/g++.dg/ext/timevar2.C
index 74c4fc8cfae..dd96d45c01e 100644
--- a/gcc/testsuite/g++.dg/ext/timevar2.C
+++ b/gcc/testsuite/g++.dg/ext/timevar2.C
@@ -1,8 +1,7 @@
 // PR c++/57524
 // { dg-options "-ftime-report" }
-// { dg-prune-output "wall" }
-// { dg-prune-output "times" }
-// { dg-prune-output "TOTAL" }
+// { dg-prune-output "Time variable" }
+// { dg-prune-output " kB" }
 // { dg-prune-output "checks" }
 
 namespace detail {
diff --git a/gcc/timevar.c b/gcc/timevar.c
index d209f5be0f5..2a7defbcc8c 100644
--- a/gcc/timevar.c
+++ b/gcc/timevar.c
@@ -641,27 +641,27 @@ timer::print_row (FILE *fp,
 
 #ifdef HAVE_USER_TIME
   /* Print user-mode time for this process.  */
-  fprintf (fp, "%7.2f (%2.0f%%)",
+  fprintf (fp, "%7.2f (%3.0f%%)",
 	   elapsed.user,
 	   (total->user == 0 ? 0 : elapsed.user / total->user) * 100);
 #endif /* HAVE_USER_TIME */
 
 #ifdef HAVE_SYS_TIME
   /* Print system-mode time for this process.  */
-  fprintf (fp, "%7.2f (%2.0f%%)",
+  fprintf (fp, "%7.2f (%3.0f%%)",
 	   elapsed.sys,
 	   (total->sys == 0 ? 0 : elapsed.sys / total->sys) * 100);
 #endif /* HAVE_SYS_TIME */
 
 #ifdef HAVE_WALL_TIME
   /* Print wall clock time elapsed.  */
-  fprintf (fp, "%7.2f (%2.0f%%)",
+  fprintf (fp, "%7.2f (%3.0f%%)",
 	   elapsed.wall,
 	   (total->wall == 0 ? 0 : elapsed.wall / total->wall) * 100);
 #endif /* HAVE_WALL_TIME */
 
   /* Print the amount of ggc memory allocated.  */
-  fprintf (fp, "%8u kB (%2.0f%%)",
+  fprintf (fp, "%8u kB (%3.0f%%)",
 	   (unsigned) (elapsed.ggc_mem >> 10),
 	   (total->ggc_mem == 0
 	    ? 0
@@ -712,7 +712,7 @@ timer::print (FILE *fp)
      TIMEVAR.  */
   m_start_time = now;
 
-  fprintf (fp, "\n%-35s%15s%13s%13s%17s\n", "Time variable", "usr", "sys",
+  fprintf (fp, "\n%-35s%16s%14s%14s%18s\n", "Time variable", "usr", "sys",
 	   "wall", "GGC");
   if (m_jit_client_items)
     fputs ("GCC items:\n", fp);
@@ -771,12 +771,12 @@ timer::print (FILE *fp)
   fprintf (fp, "%7.2f      ", total->user);
 #endif
 #ifdef HAVE_SYS_TIME
-  fprintf (fp, "%7.2f      ", total->sys);
+  fprintf (fp, "%8.2f      ", total->sys);
 #endif
 #ifdef HAVE_WALL_TIME
-  fprintf (fp, "%7.2f      ", total->wall);
+  fprintf (fp, "%8.2f      ", total->wall);
 #endif
-  fprintf (fp, "%8u kB\n", (unsigned) (total->ggc_mem >> 10));
+  fprintf (fp, "%9u kB\n", (unsigned) (total->ggc_mem >> 10));
 
   if (CHECKING_P || flag_checking)
     fprintf (fp, "Extra diagnostic checks enabled; compiler may run slowly.\n");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]