Record more artifact sizes during self-profiling.

This commit is contained in:
Michael Woerister 2021-11-08 16:59:36 +01:00
parent 3e3890c9d4
commit fefe1e9192
4 changed files with 73 additions and 0 deletions

View file

@ -121,6 +121,19 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
if sess.opts.json_artifact_notifications {
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename, "link");
}
if sess.prof.enabled() {
if let Some(artifact_name) = out_filename.file_name() {
// Record size for self-profiling
let file_size = std::fs::metadata(&out_filename).map(|m| m.len()).unwrap_or(0);
sess.prof.artifact_size(
"linked_artifact",
artifact_name.to_string_lossy(),
file_size,
);
}
}
}
}