Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct CollectorParams {
pub runlog: PathBuf,
pub pmu_config: Option<PathBuf>,
pub perf_frequency: u32,
pub save_profile_events: bool,
pub hotline_frequency: u32,
pub interval: u64,
pub num_to_report: u32,
Expand All @@ -97,6 +98,7 @@ impl CollectorParams {
runlog: PathBuf::new(),
pmu_config: None,
perf_frequency: 99,
save_profile_events: false,
hotline_frequency: 1000,
interval: 1,
num_to_report: 5000,
Expand Down Expand Up @@ -153,6 +155,8 @@ impl DataType {
self.collector_params.profile = param.profile.clone();
self.collector_params.tmp_dir = param.tmp_dir.clone();
self.collector_params.runlog = param.runlog.clone();
self.collector_params.perf_frequency = param.perf_frequency;
self.collector_params.save_profile_events = param.save_profile_events;
self.collector_params.pmu_config = param.pmu_config.clone();
self.collector_params.interval = param.interval;
self.collector_params.hotline_frequency = param.hotline_frequency;
Expand Down
11 changes: 10 additions & 1 deletion src/data/java_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,16 @@ impl CollectData for JavaProfileRaw {
"{}-java-profile-{}-profiler-data.json",
params.run_name, key
));
match jfr::jfr_to_profiler(&jfr_path) {

let event_out_path_buf =
params.data_dir.join(format!("parsed_jfr_events_{key}.out"));
let events_out_path = if params.save_profile_events {
Some(event_out_path_buf.as_path())
} else {
None
};

match jfr::build_java_profiler_data(&jfr_path, events_out_path) {
Ok(mut profiler) => {
profiler.metadata = jfr::parse_jfr_metadata(&metadata_json);
if let Ok(json) = serde_json::to_string(&profiler) {
Expand Down
8 changes: 8 additions & 0 deletions src/data/perf_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ impl CollectData for PerfProfileRaw {
Ok(_) => debug!("'perf record' executed successfully."),
}

let event_out_path_buf = params.data_dir.join("parsed_perf_data.out");
let events_out_path = if params.save_profile_events {
Some(event_out_path_buf.as_path())
} else {
None
};

// Parse raw Perf profile and build ProfilingData
let perf_profiler_data = build_perf_profiler_data(
&params.data_file_path,
*PROFILE_START_TIME_MS.lock().unwrap(),
events_out_path,
);
let perf_profiler_data_path = params
.data_dir
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ pub struct InitParams {
pub tmp_dir: PathBuf,
pub runlog: PathBuf,
pub perf_frequency: u32,
pub save_profile_events: bool,
pub hotline_frequency: u32,
pub num_to_report: u32,
/// Wall-clock start of `collect_data_serial`. `None` for archives
Expand Down Expand Up @@ -592,6 +593,7 @@ impl InitParams {
tmp_dir: PathBuf::from(APERF_TMP),
runlog: PathBuf::new(),
perf_frequency: 99,
save_profile_events: false,
hotline_frequency: 1000,
num_to_report: 5000,
collection_start: None,
Expand Down
Loading
Loading