Skip to content

Deduplicate walltime perf symbols, unwind data and debug info across pids#240

Open
GuillaumeLagrange wants to merge 3 commits intomainfrom
cod-2138-deduplicate-perf-maps-and-unwind_data
Open

Deduplicate walltime perf symbols, unwind data and debug info across pids#240
GuillaumeLagrange wants to merge 3 commits intomainfrom
cod-2138-deduplicate-perf-maps-and-unwind_data

Conversation

@GuillaumeLagrange
Copy link
Contributor

@GuillaumeLagrange GuillaumeLagrange commented Feb 11, 2026

Since the real deduplicator source of truth is actually the path of the elf file on disk, I settled on

{path_index}__{file_name}.unwind_data
{path_index}__{file_name}.symbols.map

it allows for the filename to be determined by the actual path, without having to either nest all the files, or have to sanitize paths to file name and end up in awkward file-name length limitations

Here's what it looks like on a 1000 iterations report of one simple program

$ ls
0__exec-harness.symbols.map          3__ld-linux-x86-64.so.2.unwind_data  7__nix-ld.symbols.map         perf.metadata
0__exec-harness.unwind_data          4__ld-linux-x86-64.so.2.symbols.map  7__nix-ld.unwind_data         perf.pipedata
1__libm.so.6.symbols.map             4__ld-linux-x86-64.so.2.unwind_data  8__libc.so.6.symbols.map      results
1__libm.so.6.unwind_data             5__libgcc_s.so.1.symbols.map         8__libc.so.6.unwind_data      runner.log
2__graph-benchmark.symbols.map       5__libgcc_s.so.1.unwind_data         9__libgcc_s.so.1.symbols.map
2__graph-benchmark.unwind_data       6__libc.so.6.symbols.map             9__libgcc_s.so.1.unwind_data
3__ld-linux-x86-64.so.2.symbols.map  6__libc.so.6.unwind_data             ExecutionTimestamps.msgpack


@GuillaumeLagrange GuillaumeLagrange changed the title Cod 2138 deduplicate perf maps and unwind data Deduplicate walltime perf symbols, unwind data and debug info across pids Feb 11, 2026
@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch from 99e0ea4 to 1a32faa Compare February 11, 2026 14:45
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 11, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing cod-2138-deduplicate-perf-maps-and-unwind_data (9a7f9bc) with main (ad6011b)

Open in CodSpeed

@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch 2 times, most recently from 15316f4 to 9305a03 Compare February 12, 2026 03:37
@GuillaumeLagrange GuillaumeLagrange marked this pull request as ready for review February 12, 2026 08:49
@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch from a3617af to 7f65690 Compare February 12, 2026 11:14
Copy link
Member

@not-matthias not-matthias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the struct naming can be clarified a bit, I was struggling quite a lot to understand how they map together. Maybe also using custom types for the key that's used in the hashmaps.

The overall logic looks good! Next round should be quick

@GuillaumeLagrange GuillaumeLagrange removed the request for review from art049 February 13, 2026 11:04
@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch 3 times, most recently from 8c864c5 to 692a99b Compare February 13, 2026 16:33
This fixes a regression introduced in 8b37208.
We now filter pids using `bench_pids`, except for `exec-harness` integrations,
where we take all pids.
@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch 2 times, most recently from 192d2ce to 14cb24f Compare February 13, 2026 16:45
- Store pid-agnostic data in a file or json map under a mapped
`path_key` for each elf
- For each pid, store pid specific data, mostly the computed
load_bias from where each module was loaded into memory at
runtime, alongside a key to retrieve the pid-agnostic data

This way, we only write to disk relevant parts of the information.
Also add a rebuild trigger to make it easier to run
GITHUB_ACTIONS=1 cargo test` locally.

We could have a better trigger, but this will do for now.
@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2138-deduplicate-perf-maps-and-unwind_data branch from 14cb24f to 9a7f9bc Compare February 13, 2026 16:55
Copy link
Member

@not-matthias not-matthias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Just a few minor stylistic comments.

pub mod unwind_data;

const PERF_METADATA_CURRENT_VERSION: u64 = 1;
const PERF_METADATA_CURRENT_VERSION: u64 = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we skip 2 here? 😄

use std::path::PathBuf;

#[derive(Default)]
pub struct MountedModule {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if "mounted" is the right name for this. Wouldn't it be more like MappedModule?

/// Unwind data extracted from the mapped ELF file
pub unwind_data: Option<UnwindData>,
/// Per-process mounting information
pub process_mounted_module: HashMap<pid_t, ProcessMountedModule>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines +137 to +138
let load_bias =
assert_and_get_load_bias(start_addr, end_addr, file_offset, MODULE_PATH, 0x0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have to change it, but we could instead also define a variable load_bias that is passed as the last parameter to assert_load_bias, which we then can also use below in the unwind_data_from_elf

Feels a bit cleaner than having a assert_and_get function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants