Skip to content

Commit 8f1a1a0

Browse files
author
Stephan Dilly
committed
fix windows pprof build
1 parent 972f071 commit 8f1a1a0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ serde = "1.0"
4040
anyhow = "1.0.31"
4141
unicode-width = "0.1"
4242

43-
[target.'cfg(unix)'.dependencies]
44-
pprof = { version = "0.3", features = ["flamegraph"], optional = true }
45-
[target.'cfg(macos)'.dependencies]
43+
[target.'cfg(not(windows))'.dependencies]
4644
pprof = { version = "0.3", features = ["flamegraph"], optional = true }
4745

4846
[badges]

src/profiler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
/// also we make sure to generate a flamegraph on program exit
33
pub struct Profiler {
44
#[cfg(feature = "pprof")]
5+
#[cfg(not(windows))]
56
guard: pprof::ProfilerGuard<'static>,
67
}
78

89
impl Profiler {
910
pub fn new() -> Self {
1011
Self {
1112
#[cfg(feature = "pprof")]
13+
#[cfg(not(windows))]
1214
guard: pprof::ProfilerGuard::new(100)
1315
.expect("profiler launch error"),
1416
}
1517
}
1618

1719
fn report(&mut self) {
1820
#[cfg(feature = "pprof")]
21+
#[cfg(not(windows))]
1922
if let Ok(report) = self.guard.report().build() {
2023
let file = std::fs::File::create("flamegraph.svg")
2124
.expect("flamegraph file err");

0 commit comments

Comments
 (0)