Use SIZE_AMOUNT macro for GGC memory allocation numbers.

gcc/ChangeLog:

	* ggc-common.c (ggc_prune_overhead_list): Use SIZE_AMOUNT.
	* ggc-page.c (release_pages): Likewise.
	(ggc_collect): Likewise.
	(ggc_trim): Likewise.
	(ggc_grow): Likewise.
	* timevar.c (timer::print): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/timevar1.C: Prune more possible number values.
	* g++.dg/ext/timevar2.C: Likewise.
This commit is contained in:
Martin Liska 2020-09-02 14:30:16 +02:00
parent 432c551b17
commit 79f4e20dd1
5 changed files with 18 additions and 17 deletions

View File

@ -1008,7 +1008,7 @@ ggc_prune_overhead_list (void)
}
}
/* Print memory used by heap in kb if this info is available. */
/* Print memory used by heap if this info is available. */
void
report_heap_memory_use ()
@ -1020,7 +1020,7 @@ report_heap_memory_use ()
#define MALLINFO_FN mallinfo
#endif
if (!quiet_flag)
fprintf (stderr," {heap %luk}",
(unsigned long) MALLINFO_FN ().arena / ONE_K);
fprintf (stderr, " {heap " PRsa (0) "}",
SIZE_AMOUNT (MALLINFO_FN ().arena));
#endif
}

View File

@ -1164,9 +1164,9 @@ release_pages (void)
{
fprintf (stderr, " {GC");
if (n1)
fprintf (stderr, " released %luk", (unsigned long)(n1 / 1024));
fprintf (stderr, " released " PRsa (0), SIZE_AMOUNT (n1));
if (n2)
fprintf (stderr, " madv_dontneed %luk", (unsigned long)(n2 / 1024));
fprintf (stderr, " madv_dontneed " PRsa (0), SIZE_AMOUNT (n2));
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 " PRsa (0) " -> ", SIZE_AMOUNT (allocated));
/* 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, PRsa (0) "}", SIZE_AMOUNT (G.allocated));
if (GGC_DEBUG_LEVEL >= 2)
fprintf (G.debug_file, "END COLLECTING\n");
}
@ -2250,9 +2250,8 @@ 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 " PRsa (0) ", " PRsa (0) " mapped}",
SIZE_AMOUNT (G.allocated), SIZE_AMOUNT (G.bytes_mapped));
timevar_pop (TV_GC);
}
@ -2269,7 +2268,7 @@ ggc_grow (void)
else
ggc_collect ();
if (!quiet_flag)
fprintf (stderr, " {GC %luk} ", (unsigned long) G.allocated / 1024);
fprintf (stderr, " {GC " PRsa (0) "} ", SIZE_AMOUNT (G.allocated));
}
void

View File

@ -2,7 +2,8 @@
// { dg-options "-ftime-report" }
// { dg-allow-blank-lines-in-output 1 }
// { dg-prune-output "Time variable" }
// { dg-prune-output " kB" }
// { dg-prune-output "k" }
// { dg-prune-output " 0 " }
// { dg-prune-output "checks" }
void

View File

@ -1,7 +1,8 @@
// PR c++/57524
// { dg-options "-ftime-report" }
// { dg-prune-output "Time variable" }
// { dg-prune-output " kB" }
// { dg-prune-output "k" }
// { dg-prune-output " 0 " }
// { dg-prune-output "checks" }
namespace detail {

View File

@ -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, PRsa (6) " (%3.0f%%)",
SIZE_AMOUNT (elapsed.ggc_mem),
(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%14s\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, PRsa (7) "\n", SIZE_AMOUNT (total->ggc_mem));
if (CHECKING_P || flag_checking)
fprintf (fp, "Extra diagnostic checks enabled; compiler may run slowly.\n");