summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-29 20:57:11 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-29 20:57:11 +0000
commit2a8997e85cd4ad92644cad6932aa2b5e2115d610 (patch)
tree467a74cb03ab3a07329d87c25f28745ba9ed5e7f /gcc/toplev.c
parent14da2a08382098d9b235ebe6ab1d02e5c3cb24d0 (diff)
downloadgcc-2a8997e85cd4ad92644cad6932aa2b5e2115d610.tar.gz
* flags.h (time_report, mem_report): New global flags.
* toplev.c: Define time_report and mem_report. (f_options): Add -ftime-report and -fmem-report. (compile_file): Turn on time_report if quiet_flag is off. Call ggc_print_statistics at very end if mem_report is on. * timevar.c (TIMEVAR_ENABLE): Examine time_report, not quiet_flag. * ggc-common.c (ggc_print_statistics): Rename to ggc_print_common_statistics; all callers changed. Scale quantities above 10K to kilobytes and above 10M to megabytes. * ggc-page.c (ggc_page_print_statistics): Rename to ggc_print_statistics. Report memory consumed by internal data structures for each allocation bucket. Scale quantities above 10K to kilobytes and above 10M to megabytes. * ggc-simple.c: Prototype debug_ggc_tree to avoid warning. Cast PTR_KEY(p) to unsigned long in fprintf call to avoid warning. Define tally_leaves always. (ggc_print_statistics): New function. * ggc.h: Adjust for renamed functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 8fac38b1ca0..b14a1ee42a9 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -464,10 +464,19 @@ int pedantic = 0;
int in_system_header = 0;
-/* Don't print functions as they are compiled and don't print
- times taken by the various passes. -quiet. */
+/* Don't print functions as they are compiled. -quiet. */
int quiet_flag = 0;
+
+/* Print times taken by the various passes. -ftime-report. */
+
+int time_report = 0;
+
+/* Print memory still in use at end of compilation (which may have little
+ to do with peak memory consumption). -fmem-report. */
+
+int mem_report = 0;
+
/* -f flags. */
@@ -1122,7 +1131,11 @@ lang_independent_options f_options[] =
{"bounds-check", &flag_bounds_check, 1,
"Generate code to check bounds before dereferencing pointers and arrays" },
{"single-precision-constant", &flag_single_precision_constant, 1,
- "Convert floating point constant to single precision constant"}
+ "Convert floating point constant to single precision constant"},
+ {"time-report", &time_report,
+ "Report time taken by each compiler pass at end of run"},
+ {"mem-report", &mem_report,
+ "Report on permanent memory allocation at end of run"},
};
/* Table of language-specific options. */
@@ -2101,6 +2114,9 @@ compile_file (name)
if (dump_base_name == 0)
dump_base_name = name ? name : "gccdump";
+ if (! quiet_flag)
+ time_report = 1;
+
/* Start timing total execution time. */
init_timevar ();
@@ -2464,6 +2480,9 @@ compile_file (name)
}
}
+ if (mem_report)
+ ggc_print_statistics ();
+
/* Free up memory for the benefit of leak detectors. */
free_reg_info ();