Clang has recently added a
-ftime-trace flag that outputs a flame chart detailing how long different parts of the code being compiled took to do so. I wasn't sure whether this meant that passing flags to
rustc will produce this info about a given rust program, and searching didn't directly give me the answer to that, so I tried it.
The first step there was running
rustc -C llvm-args="--version" to confirm that the version matched the version of Clang that has the new flag. The output was as follows:
LLVM (http://llvm.org/): LLVM version 9.0.0-rust-1.38.0-stable DEBUG build.
Along with some information about the target and host CPU. (By the way, I hope that "DEBUG build." doesn't mean that rustc is using an unoptimized build of LLVM!) The new flag came with Clang version 9.0.0, so that looked promising. However, neither
rustc -C llvm-args="--help" nor
rustc -C llvm-args="--help-list-hidden" listed
-ftime-trace, and just trying it anyway produced an error.
--time-trace-granularity was listed, which appears to be an optional flag related to the time trace flag. Running
cargo rustc -- -C llvm-args="--time-trace-granularity=1000000" successfully builds the project I tried it on, but no
.json file was produced in the