[gcc(refs/users/marxin/heads/mallinfo2-and-refactoring)] Change timevar memory allocation to MiB.

Martin Liska marxin@gcc.gnu.org
Tue Sep 1 13:35:09 GMT 2020


https://gcc.gnu.org/g:e177610161e8ec22fee70bb2339195b5104bd30e

commit e177610161e8ec22fee70bb2339195b5104bd30e
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Sep 1 14:44:40 2020 +0200

    Change timevar memory allocation to MiB.
    
    gcc/ChangeLog:
    
            * timevar.c (timer::print): Print memory allocation in MiB.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/ext/timevar1.C: Expect values in MiB.
            * g++.dg/ext/timevar2.C: Likewise.

Diff:
---
 gcc/testsuite/g++.dg/ext/timevar1.C | 2 +-
 gcc/testsuite/g++.dg/ext/timevar2.C | 2 +-
 gcc/timevar.c                       | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/g++.dg/ext/timevar1.C b/gcc/testsuite/g++.dg/ext/timevar1.C
index 3f891a50aba..d810ebe3451 100644
--- a/gcc/testsuite/g++.dg/ext/timevar1.C
+++ b/gcc/testsuite/g++.dg/ext/timevar1.C
@@ -2,7 +2,7 @@
 // { dg-options "-ftime-report" }
 // { dg-allow-blank-lines-in-output 1 }
 // { dg-prune-output "Time variable" }
-// { dg-prune-output " kB" }
+// { dg-prune-output " MiB" }
 // { dg-prune-output "checks" }
 
 void
diff --git a/gcc/testsuite/g++.dg/ext/timevar2.C b/gcc/testsuite/g++.dg/ext/timevar2.C
index dd96d45c01e..fa68aac7e72 100644
--- a/gcc/testsuite/g++.dg/ext/timevar2.C
+++ b/gcc/testsuite/g++.dg/ext/timevar2.C
@@ -1,7 +1,7 @@
 // PR c++/57524
 // { dg-options "-ftime-report" }
 // { dg-prune-output "Time variable" }
-// { dg-prune-output " kB" }
+// { dg-prune-output " MiB" }
 // { dg-prune-output "checks" }
 
 namespace detail {
diff --git a/gcc/timevar.c b/gcc/timevar.c
index a3a882d3204..43b17571da2 100644
--- a/gcc/timevar.c
+++ b/gcc/timevar.c
@@ -661,8 +661,8 @@ timer::print_row (FILE *fp,
 #endif /* HAVE_WALL_TIME */
 
   /* Print the amount of ggc memory allocated.  */
-  fprintf (fp, "%8u kB (%3.0f%%)",
-	   (unsigned) (elapsed.ggc_mem >> 10),
+  fprintf (fp, "%8u MiB (%3.0f%%)",
+	   (unsigned ) (elapsed.ggc_mem / ONE_M),
 	   (total->ggc_mem == 0
 	    ? 0
 	    : (float) elapsed.ggc_mem / total->ggc_mem) * 100);
@@ -712,7 +712,7 @@ timer::print (FILE *fp)
      TIMEVAR.  */
   m_start_time = now;
 
-  fprintf (fp, "\n%-35s%16s%14s%14s%18s\n", "Time variable", "usr", "sys",
+  fprintf (fp, "\n%-35s%16s%14s%14s%19s\n", "Time variable", "usr", "sys",
 	   "wall", "GGC");
   if (m_jit_client_items)
     fputs ("GCC items:\n", fp);
@@ -776,7 +776,7 @@ timer::print (FILE *fp)
 #ifdef HAVE_WALL_TIME
   fprintf (fp, "%8.2f      ", total->wall);
 #endif
-  fprintf (fp, "%9u kB\n", (unsigned) (total->ggc_mem >> 10));
+  fprintf (fp, "%9u MiB\n", (unsigned) (total->ggc_mem / ONE_M));
 
   if (CHECKING_P || flag_checking)
     fprintf (fp, "Extra diagnostic checks enabled; compiler may run slowly.\n");


More information about the Gcc-cvs mailing list