[gcc(refs/users/marxin/heads/mallinfo2-and-refactoring)] Use MiB unit when displaying memory allocation.

Martin Liska marxin@gcc.gnu.org
Tue Sep 1 12:25:34 GMT 2020


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

commit e146c9b89c396c71f71ea813d54868864a59ace6
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Sep 1 14:20:21 2020 +0200

    Use MiB unit when displaying memory allocation.
    
    gcc/ChangeLog:
    
            * ggc-page.c (release_pages): Display memory usage in MiB.
            (ggc_collect): Likewise.
            (ggc_trim): Likewise.
            (ggc_grow): Likewise.

Diff:
---
 gcc/ggc-page.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 53b311c2a52..0a43a7cdc0e 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -1164,9 +1164,9 @@ release_pages (void)
     {
       fprintf (stderr, " {GC");
       if (n1)
-	fprintf (stderr, " released %luk", (unsigned long)(n1 / 1024));
+	fprintf (stderr, " released %lu MiB", (unsigned long)(n1 / ONE_M));
       if (n2)
-	fprintf (stderr, " madv_dontneed %luk", (unsigned long)(n2 / 1024));
+	fprintf (stderr, " madv_dontneed %lu MiB", (unsigned long)(n2 / ONE_M));
       fprintf (stderr, "}");
     }
 }
@@ -2208,7 +2208,7 @@ ggc_collect (void)
 
   /* Output this later so we do not interfere with release_pages.  */
   if (!quiet_flag)
-    fprintf (stderr, " {GC %luk -> ", (unsigned long) allocated / 1024);
+    fprintf (stderr, " {GC %lu MiB -> ", (unsigned long) allocated / ONE_M);
 
   /* Indicate that we've seen collections at this context depth.  */
   G.context_depth_collections = ((unsigned long)1 << (G.context_depth + 1)) - 1;
@@ -2235,7 +2235,7 @@ ggc_collect (void)
   timevar_pop (TV_GC);
 
   if (!quiet_flag)
-    fprintf (stderr, "%luk}", (unsigned long) G.allocated / 1024);
+    fprintf (stderr, "%lu MiB}", (unsigned long) G.allocated / ONE_M);
   if (GGC_DEBUG_LEVEL >= 2)
     fprintf (G.debug_file, "END COLLECTING\n");
 }
@@ -2250,9 +2250,9 @@ ggc_trim ()
   sweep_pages ();
   release_pages ();
   if (!quiet_flag)
-    fprintf (stderr, " {GC trimmed to %luk, %luk mapped}",
-	     (unsigned long) G.allocated / 1024,
-	     (unsigned long) G.bytes_mapped / 1024);
+    fprintf (stderr, " {GC trimmed to %lu MiB, %lu MiB mapped}",
+	     (unsigned long) G.allocated / ONE_M,
+	     (unsigned long) G.bytes_mapped / ONE_M);
   timevar_pop (TV_GC);
 }
 
@@ -2269,7 +2269,7 @@ ggc_grow (void)
   else
     ggc_collect ();
   if (!quiet_flag)
-    fprintf (stderr, " {GC %luk} ", (unsigned long) G.allocated / 1024);
+    fprintf (stderr, " {GC %lu MiB} ", (unsigned long) G.allocated / ONE_M);
 }
 
 void


More information about the Gcc-cvs mailing list