(
&mut self,
mut cmd_builder: CommandBuilder,
config: &ExecutorConfig,
profile_folder: &Path,
requires_sudo: bool,
)
| 80 | } |
| 81 | |
| 82 | async fn wrap_command( |
| 83 | &mut self, |
| 84 | mut cmd_builder: CommandBuilder, |
| 85 | config: &ExecutorConfig, |
| 86 | profile_folder: &Path, |
| 87 | requires_sudo: bool, |
| 88 | ) -> anyhow::Result<CommandBuilder> { |
| 89 | let perf_fifo = PerfFifo::new()?; |
| 90 | let perf_file_path = profile_folder.join(PERF_PIPEDATA_FILE_NAME); |
| 91 | |
| 92 | let unwinding = resolve_unwinding(&config.command, config.walltime_unwinding); |
| 93 | |
| 94 | let cg_mode = match unwinding { |
| 95 | WalltimeUnwinding::FramePointer => { |
| 96 | suppress_go_perf_unwinding_warning(); |
| 97 | "fp" |
| 98 | } |
| 99 | WalltimeUnwinding::Dwarf { stack_size } => { |
| 100 | &format!("dwarf,{}", stack_size.unwrap_or(8 * 1024)) |
| 101 | } |
| 102 | }; |
| 103 | debug!("Using call graph mode: {cg_mode:?}"); |
| 104 | |
| 105 | let working_perf_executable = |
| 106 | get_working_perf_executable().context("Failed to find a working perf executable")?; |
| 107 | let mut perf_wrapper_builder = CommandBuilder::new(&working_perf_executable); |
| 108 | perf_wrapper_builder.arg("record"); |
| 109 | if !is_codspeed_debug_enabled() { |
| 110 | perf_wrapper_builder.arg("--quiet"); |
| 111 | } |
| 112 | // Add compression if available |
| 113 | if let Some(compression_flags) = get_compression_flags(&working_perf_executable)? { |
| 114 | perf_wrapper_builder.arg(compression_flags); |
| 115 | // Add events flag if all required events are available |
| 116 | if let Some(events_flag) = get_event_flags(&working_perf_executable)? { |
| 117 | perf_wrapper_builder.arg(events_flag); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | perf_wrapper_builder.args([ |
| 122 | "--timestamp", |
| 123 | // Required for matching the markers and URIs to the samples. |
| 124 | "-k", |
| 125 | "CLOCK_MONOTONIC", |
| 126 | &format!("--freq={SAMPLING_RATE_HZ}"), |
| 127 | "--delay=-1", |
| 128 | "-g", |
| 129 | "--user-callchains", |
| 130 | &format!("--call-graph={cg_mode}"), |
| 131 | &format!( |
| 132 | "--control=fifo:{},{}", |
| 133 | perf_fifo.ctl_path().to_string_lossy(), |
| 134 | perf_fifo.ack_path().to_string_lossy() |
| 135 | ), |
| 136 | "-o", |
| 137 | "-", // Output to stdout for piping |
| 138 | "--", |
| 139 | ]); |
no test coverage detected