I'm doing some research and I'd like to get a more in-depth look at the different stages of compilation to get a better picture of how compilation performance is affected and by what changes. However, I haven't been able to find a simple way to get separate information regarding the build times of the driver creating different jobs, compiling different source files (parsing, performing semantic analysis, generating SIL, etc.), and linking. I can condense my project into one file, so it'd be great if I could just see the time it takes for different stages of compilation and linking to produce the resulting executable.
swift build -c=debug -Xswiftc -driver-show-incremental -Xswiftc -driver-show-job-lifecycle -Xswiftc -debug-time-function-bodies -Xswiftc -parseable-output -Xswiftc -output-file-map=./FileMap.json -Xswiftc builtin-Swift-Compilation
The result outlined the times it took to analyze or create code for (?) different declarations, which isn't exactly the stage-specific file-level overview I was looking for.
I also found article about getting build time analysis but it's for Xcode. I try to stay away from proprietary software from my research since Apple may be changing things behind the scenes (e.g. the recent build-time improvements) and we may not know that. Also, the recommended
Build with Timing Summary doesn't really like that I have a custom toolchain (because the toolchain has different versions of library SDKs) which causes the build to fail.
So is there a (relatively) easy way to get more fine-grained output of compilation stages for a single file without involving Xcode?