GCC -ftime-trace

Basile Starynkevitch basile@starynkevitch.net
Sat Feb 11 19:36:53 GMT 2023

Hello all,

Shivansh Khare wrote:

> I have looked into the different starter projects that are offered in the
> [Wiki GSoC page](https://gcc.gnu.org/wiki/SummerOfCode) and I was
> particularly interested in the `-ftime-trace` project. The following is
> what is given as a short description about the problematic:
> "Implement something similar to Clang's -ftime-trace feature which
> generates performance reports that show where the compiler spends compile
> time. For more information, please check the following blog post.

Are you aware of the existing -ftime-report option to GCC 12 or later?

On Linux (and probably many other POSIX) systems, at least in straight 
(non-cross) x86-64 GCC compilers, implementing that should be not very 
difficult. Here are some insights.

Read carefully https://man7.org/linux/man-pages/man7/time.7.html

First, you could experiment by writing a GCC plugin doing that timing 
(in some experimental way). 

Maybe consider later providing such a "standard" GCC plugin to do the 

Modifying the pass manager 
https://gcc.gnu.org/onlinedocs/gccint/Pass-manager.html#Pass-manager to 
use clock_gettime system call. See 

It is related to plugin gate functions...


BTW, my pet open source project is http://refpersys.org/ (symbolic 
inference engine, work in progress).

Basile Starynkevitch                  <basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/

More information about the Gcc mailing list