There were some discussions here about -ftime-trace. I've written a GCC plugin with similar functionality last year: https://github.com/royjacobson/externis. It works at least on GCC11 and GCC12. It was written by practically reverse engineering the GCC AST and can only make use of the GCC plugin callbacks, which are very limited, so the information it provides is sometimes inaccurate and heuristic. But maybe it can help by providing something to iterate on. Cheers, Roy