(
&mut self,
mut cmd_builder: CommandBuilder,
_config: &ExecutorConfig,
profile_folder: &Path,
isolate: bool,
)
| 82 | } |
| 83 | |
| 84 | async fn wrap_command( |
| 85 | &mut self, |
| 86 | mut cmd_builder: CommandBuilder, |
| 87 | _config: &ExecutorConfig, |
| 88 | profile_folder: &Path, |
| 89 | isolate: bool, |
| 90 | ) -> anyhow::Result<CommandBuilder> { |
| 91 | let output_path = profile_folder.join(SAMPLY_OUTPUT_FILE_NAME); |
| 92 | |
| 93 | // samply is bundled into this binary as the `samply` subcommand; |
| 94 | // re-exec ourselves so we don't depend on a system install. |
| 95 | let samply_builder = InternalCommands::Samply(SamplyArgs { |
| 96 | args: vec![ |
| 97 | "record".into(), |
| 98 | "--presymbolicate".into(), |
| 99 | "--no-open".into(), |
| 100 | "--save-only".into(), |
| 101 | "--rate".into(), |
| 102 | SAMPLING_RATE_HZ.to_string().into(), |
| 103 | "-o".into(), |
| 104 | output_path.clone().into(), |
| 105 | "--".into(), |
| 106 | ], |
| 107 | }) |
| 108 | .get_command_builder()?; |
| 109 | |
| 110 | cmd_builder.wrap_with(samply_builder); |
| 111 | |
| 112 | cmd_builder.envs([ |
| 113 | // Disable JIT classification as it produces duplicates symbols in |
| 114 | // Node.js for the Interpreter frames. |
| 115 | ("SAMPLY_DISABLE_JIT_CLASSIFICATION", "1"), |
| 116 | ("SAMPLY_USE_DEBUGINFOD", "1"), |
| 117 | // TODO(COD-2701): Implement this properly |
| 118 | ( |
| 119 | "SAMPLY_BREAKPAD_SYMBOL_SERVER", |
| 120 | "https://symbols.mozilla.org/,https://symbols.electronjs.org/", |
| 121 | ), |
| 122 | ]); |
| 123 | |
| 124 | let v8_log_dir = tempfile::tempdir().context("failed to create V8 code log directory")?; |
| 125 | cmd_builder.env("CODSPEED_V8_LOG", v8_log_dir.path()); |
| 126 | |
| 127 | // Extra hardware events to capture alongside the sampling event, |
| 128 | // stored by samply as per-sample delta columns in the profile, as |
| 129 | // `<name>:<type>:<config>` specs resolved for the CPU we run on. |
| 130 | // samply degrades gracefully to cycles-only sampling when the PMU |
| 131 | // can't deliver them, so this is safe to request unconditionally. |
| 132 | // Linux only: the events go through perf_event_open. |
| 133 | #[cfg(target_os = "linux")] |
| 134 | cmd_builder.env( |
| 135 | "SAMPLY_PERF_EVENTS", |
| 136 | runner_shared::perf_event::PerfEvent::all_events() |
| 137 | .iter() |
| 138 | .filter_map(|event| event.to_samply_spec()) |
| 139 | .join(","), |
| 140 | ); |
| 141 |
nothing calls this directly
no test coverage detected