aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-03 13:48:43 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-03 12:48:43 +0000
commitc9ef0409cd8f40ebca439ed446142fe3a2e727d3 (patch)
tree02b234403a8ac14394b85f5c47afa2fc22b9dc17 /gcc/ggc-common.c
parentda5c1bbe973db144cc1d297ad49b519a870ab0ba (diff)
downloadgcc-c9ef0409cd8f40ebca439ed446142fe3a2e727d3.zip
gcc-c9ef0409cd8f40ebca439ed446142fe3a2e727d3.tar.gz
gcc-c9ef0409cd8f40ebca439ed446142fe3a2e727d3.tar.bz2
config.in: Regenerate.
* config.in: Regenerate. * configure: Regenerate. * configure.ac: Check for mallinfo. * ggc-common.c: Include malloc.h if available; include options.h (report_heap_memory_use): New functoin. * ggc-page.c (ggc_grow): Do not print "start". * ggc.h (report_heap_memory_use): Declare. * pases.c (execute_one_pass): Report memory after IPA passes. (ipa_read_summaries_1): Likewise. (ipa_read_optimization_summaries_1): Likewise. * lto/lto-common.c (read_cgraph_and_symbols): Improve -Q reporting. * lto.c (lto_wpa_write_files): Likewise. From-SVN: r277753
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 48db420..b0a01c7 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see
any particular GC implementation. */
#include "config.h"
+#ifdef HAVE_MALLINFO
+#include <malloc.h>
+#endif
#include "system.h"
#include "coretypes.h"
#include "timevar.h"
@@ -29,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "hosthooks.h"
#include "plugin.h"
+#include "options.h"
/* When set, ggc_collect will do collection. */
bool ggc_force_collect;
@@ -1006,3 +1010,14 @@ ggc_prune_overhead_list (void)
delete ggc_mem_desc.m_reverse_object_map;
ggc_mem_desc.m_reverse_object_map = new map_t (13, false, false, false);
}
+
+/* Return memory used by heap in kb, 0 if this info is not available. */
+
+void
+report_heap_memory_use ()
+{
+#ifdef HAVE_MALLINFO
+ if (!quiet_flag)
+ fprintf (stderr," {heap %luk}", (unsigned long)(mallinfo().arena / 1024));
+#endif
+}