From e177610161e8ec22fee70bb2339195b5104bd30e Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 1 Sep 2020 14:44:40 +0200
Subject: [PATCH] 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.
---
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(-)
@@ -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
@@ -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 {
@@ -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");
--
2.28.0