Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions src/run/runner/wall_time/perf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ impl PerfRunner {

let bench_proc = procfs::process::Process::new(pid as _)
.expect("Failed to find benchmark process");
let exe_path = bench_proc.exe().expect("Failed to read /proc/{pid}/exe");
let exe_maps = bench_proc.maps().expect("Failed to read /proc/{pid}/maps");

for map in &exe_maps {
Expand All @@ -237,24 +236,39 @@ impl PerfRunner {
_ => None,
};

if let Some(path) = path {
if let Some(path) = &path {
symbols_by_pid
.entry(pid)
.or_insert(ProcessSymbols::new(pid))
.add_mapping(pid, &path, base_addr, end_addr);
.add_mapping(pid, path, base_addr, end_addr);
debug!("Added mapping for module {:?}", path);
}

if map.perms.contains(MMPermissions::EXECUTE) {
if let Ok(unwind_data) = UnwindData::new(
exe_path.to_string_lossy().as_bytes(),
page_offset,
base_addr,
end_addr - base_addr,
None,
) {
unwind_data_by_pid.entry(pid).or_default().push(unwind_data);
if map.perms.contains(MMPermissions::EXECUTE) {
match UnwindData::new(
path.to_string_lossy().as_bytes(),
page_offset,
base_addr,
end_addr - base_addr,
None,
) {
Ok(unwind_data) => {
unwind_data_by_pid
.entry(pid)
.or_default()
.push(unwind_data);
debug!("Added unwind data for {path:?} ({base_addr:x} - {end_addr:x})");
}
Err(error) => {
debug!(
"Failed to create unwind data for module {}: {}",
path.display(),
error
);
}
}
}
} else if map.perms.contains(MMPermissions::EXECUTE) {
debug!("Found executable mapping without path: {base_addr:x} - {end_addr:x}");
}
}
}
Expand Down
Loading