Add support for enabling the LLVM time-trace feature
I found this helpful while investigating an LLVM performance issue. Passing `-Z llvm-time-trace` causes a `llvm_timings.json` file to be created. This file can be inspected in either the Chrome Profiler tools or with any other compatible tool like SpeedScope. More information on the LLVM feature: - https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/ - https://reviews.llvm.org/rL357340
This commit is contained in:
parent
cd1ef390e7
commit
f5f86be1d4
5 changed files with 48 additions and 0 deletions
|
@ -332,6 +332,12 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||
// any more, we can finalize it (which involves renaming it)
|
||||
rustc_incremental::finalize_session_directory(sess, codegen_results.crate_hash);
|
||||
|
||||
sess.time("llvm_dump_timing_file", || {
|
||||
if sess.opts.debugging_opts.llvm_time_trace {
|
||||
llvm_util::time_trace_profiler_finish("llvm_timings.json");
|
||||
}
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue