Record cranelift pass timings in self profile results
This commit is contained in:
parent
469783c263
commit
a0d3b0963d
21
src/base.rs
21
src/base.rs
@ -182,6 +182,27 @@ pub(crate) fn compile_fn(
|
|||||||
cx.profiler.generic_activity("define function").run(|| {
|
cx.profiler.generic_activity("define function").run(|| {
|
||||||
context.want_disasm = cx.should_write_ir;
|
context.want_disasm = cx.should_write_ir;
|
||||||
module.define_function(codegened_func.func_id, context).unwrap();
|
module.define_function(codegened_func.func_id, context).unwrap();
|
||||||
|
|
||||||
|
if cx.profiler.enabled() {
|
||||||
|
let mut recording_args = false;
|
||||||
|
cx.profiler
|
||||||
|
.generic_activity_with_arg_recorder(
|
||||||
|
"define function (clif pass timings)",
|
||||||
|
|recorder| {
|
||||||
|
let pass_times = cranelift_codegen::timing::take_current();
|
||||||
|
// Replace newlines with | as measureme doesn't allow control characters like
|
||||||
|
// newlines inside strings.
|
||||||
|
recorder.record_arg(format!("{}", pass_times).replace("\n", " | "));
|
||||||
|
recording_args = true;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.run(|| {
|
||||||
|
if recording_args {
|
||||||
|
// Wait a tiny bit to ensure chrome's profiler doesn't hide the event
|
||||||
|
std::thread::sleep(std::time::Duration::from_nanos(2))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if cx.should_write_ir {
|
if cx.should_write_ir {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user