Understanding the output of -ftime-report

Ian Lance Taylor iant@google.com
Wed Aug 7 19:08:00 GMT 2013

On Wed, Aug 7, 2013 at 8:27 AM, Mathias Gaunard
<mathias.gaunard@ens-lyon.org> wrote:
> I'm trying to understand what each entry in -ftime-report means so that I
> can better optimize my C++ code for compilation code.
> What I currently have is attached.
> What do each of the high entries correspond to (phase generate, parser
> struct body, ...), and why could they be so high?
> Also which entries are subparts of others? Adding every percentage gives way
> more than 100%.

The times that start with "phase" are the different phases of the
compiler.  Ideally all the "phase" times should add up to 100%.  In
your case they clearly don't.  I think that was cleaned up somewhat in
the 4.8 release.

The times that start with '|' are run in conjunction with other
timers.  Ignore those when adding up numbers.

The other times are the times of specific passes.

In general you can't really make sense of the -ftime-report output
unless you look at the compiler source code.  Look at timevar.def for
the various timers, and look for timevar_start and timevar_stop to see
what they are measuring.

When it comes to changing your C++ code to speed up compilation time,
the most useful thing you can do is minimize header file inclusion.
Next, stop using templates.


More information about the Gcc-help mailing list