Skip to content

Commit d94c2a0

Browse files
not-matthiasadriencaccia
authored andcommitted
fix: only use procfs on unix platforms
1 parent 88e2fac commit d94c2a0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ linux-perf-data = "0.11.0"
5353
debugid = "0.8.0"
5454
memmap2 = "0.9.5"
5555
nix = { version = "0.29.0", features = ["fs"] }
56-
procfs = "0.17.0"
5756
futures = "0.3.31"
5857

58+
[target.'cfg(unix)'.dependencies]
59+
procfs = "0.17.0"
60+
5961
[dev-dependencies]
6062
temp-env = { version = "0.3.6", features = ["async_closure"] }
6163
insta = { version = "1.29.0", features = ["json", "redactions"] }

src/run/runner/wall_time/perf/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(unix), allow(dead_code, unused_mut))]
2+
13
use crate::prelude::*;
24
use crate::run::runner::helpers::run_command_with_log_pipe::run_command_with_log_pipe_and_callback;
35
use crate::run::runner::helpers::setup::run_with_sudo;
@@ -8,7 +10,6 @@ use fifo::{PerfFifo, RunnerFifo};
810
use futures::stream::FuturesUnordered;
911
use metadata::PerfMetadata;
1012
use perf_map::ProcessSymbols;
11-
use procfs::process::MMPermissions;
1213
use shared::Command as FifoCommand;
1314
use std::collections::HashSet;
1415
use std::path::PathBuf;
@@ -200,8 +201,11 @@ impl PerfRunner {
200201
FifoCommand::CurrentBenchmark { pid, uri } => {
201202
bench_order_by_pid.entry(pid).or_default().push(uri);
202203

204+
#[cfg(unix)]
203205
if !symbols_by_pid.contains_key(&pid) && !unwind_data_by_pid.contains_key(&pid)
204206
{
207+
use procfs::process::MMPermissions;
208+
205209
let bench_proc = procfs::process::Process::new(pid as _)
206210
.expect("Failed to find benchmark process");
207211
let exe_path = bench_proc.exe().expect("Failed to read /proc/{pid}/exe");

0 commit comments

Comments
 (0)