Skip to content

Commit 8a8e96b

Browse files
authored
Enable --unstable-presymbolicate for 'samply import' (#542)
`samply import` currently supports an `--unstable-presymbolicate` option but does not output the `.syms.json` file when this flag is enabled. This PR adds the missing code to generate the symbol JSON file, which is useful for running in CI.
2 parents a1a651e + 33457d8 commit 8a8e96b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

samply/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ fn convert_perf_data_file_to_profile(input_file: &File, import_args: &ImportArgs
812812
let file_meta = input_file.metadata().ok();
813813
let file_mod_time = file_meta.and_then(|metadata| metadata.modified().ok());
814814
let profile_creation_props = import_args.profile_creation_props();
815+
let unstable_presymbolicate = profile_creation_props.unstable_presymbolicate;
815816
let mut binary_lookup_dirs = import_args.symbol_props().symbol_dir.clone();
816817
let mut aux_file_lookup_dirs = import_args.aux_file_dir.clone();
817818
if let Some(parent_dir) = path.parent() {
@@ -833,6 +834,13 @@ fn convert_perf_data_file_to_profile(input_file: &File, import_args: &ImportArgs
833834
}
834835
};
835836
save_profile_to_file(&profile, &import_args.output).expect("Couldn't write JSON");
837+
838+
if unstable_presymbolicate {
839+
crate::shared::symbol_precog::presymbolicate(
840+
&profile,
841+
&import_args.output.with_extension("syms.json"),
842+
);
843+
}
836844
}
837845

838846
#[cfg(test)]

samply/src/windows/import.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ pub fn convert_etl_file_to_profile(
2929

3030
eprintln!("Processing ETL trace...");
3131

32+
let unstable_presymbolicate = profile_creation_props.unstable_presymbolicate;
33+
3234
let mut context =
3335
ProfileContext::new(profile, arch, included_processes, profile_creation_props);
3436

3537
etw_gecko::process_etl_files(&mut context, filename, extra_etl_filenames);
3638

3739
let profile = context.finish();
3840
save_profile_to_file(&profile, output_file).expect("Couldn't write JSON");
41+
42+
if unstable_presymbolicate {
43+
crate::shared::symbol_precog::presymbolicate(
44+
&profile,
45+
&output_file.with_extension("syms.json"),
46+
);
47+
}
3948
}
4049

4150
#[cfg(target_arch = "x86")]

0 commit comments

Comments
 (0)