Skip to content

Commit

Permalink
Handle CoreCLR events (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuk authored May 12, 2024
1 parent 3049f62 commit 11faaec
Show file tree
Hide file tree
Showing 8 changed files with 793 additions and 81 deletions.
10 changes: 8 additions & 2 deletions samply/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ struct RecordArgs {
#[arg(long)]
coreclr: bool,

/// Enable CoreCLR fine-grained allocation event capture (Windows only).
#[cfg(target_os = "windows")]
#[arg(long)]
coreclr_allocs: bool,

/// VM hack for arm64 Windows VMs to not try to record PROFILE events (Windows only).
#[cfg(target_os = "windows")]
#[arg(long)]
Expand Down Expand Up @@ -379,9 +384,9 @@ impl RecordArgs {
let interval = Duration::from_secs_f64(1.0 / self.rate);
cfg_if::cfg_if! {
if #[cfg(target_os = "windows")] {
let (coreclr, vm_hack) = (self.coreclr, self.vm_hack);
let (coreclr, coreclr_allocs, vm_hack) = (self.coreclr, self.coreclr_allocs, self.vm_hack);
} else {
let (coreclr, vm_hack) = (false, false);
let (coreclr, coreclr_allocs, vm_hack) = (false, false, false);
}
}
RecordingProps {
Expand All @@ -390,6 +395,7 @@ impl RecordArgs {
interval,
main_thread_only: self.main_thread_only,
coreclr,
coreclr_allocs,
vm_hack,
}
}
Expand Down
2 changes: 2 additions & 0 deletions samply/src/shared/recording_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ use std::time::Duration;

/// Properties which are meaningful both for recording a fresh process
/// as well as for recording an existing process.
#[derive(Debug, Clone)]
pub struct RecordingProps {
pub output_file: PathBuf,
pub time_limit: Option<Duration>,
pub interval: Duration,
pub main_thread_only: bool,
pub coreclr: bool,
pub coreclr_allocs: bool,
pub vm_hack: bool,
}

Expand Down
Loading

0 comments on commit 11faaec

Please sign in to comment.