Skip to content

Commit 47bf3b7

Browse files
committed
Bump perf-event from 0.4.7. to 0.4.8
1 parent 74afb04 commit 47bf3b7

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/profile/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ doctest = false
1616
cfg-if = "1.0.1"
1717
jemalloc-ctl = { version = "0.5.4", package = "tikv-jemalloc-ctl", optional = true }
1818

19-
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
20-
perf-event = "=0.4.7"
19+
[target.'cfg(all(target_os = "linux", not(target_env = "ohos"), any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))'.dependencies]
20+
perf-event = "=0.4.8"
2121

2222
[target.'cfg(all(target_os = "linux", target_env = "gnu"))'.dependencies]
2323
libc.workspace = true

crates/profile/src/stop_watch.rs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use crate::MemoryUsage;
1111

1212
pub struct StopWatch {
1313
time: Instant,
14-
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
14+
#[cfg(all(
15+
target_os = "linux",
16+
not(target_env = "ohos"),
17+
any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
18+
))]
1519
counter: Option<perf_event::Counter>,
1620
memory: MemoryUsage,
1721
}
@@ -24,7 +28,11 @@ pub struct StopWatchSpan {
2428

2529
impl StopWatch {
2630
pub fn start() -> StopWatch {
27-
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
31+
#[cfg(all(
32+
target_os = "linux",
33+
not(target_env = "ohos"),
34+
any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
35+
))]
2836
let counter = {
2937
// When debugging rust-analyzer using rr, the perf-related syscalls cause it to abort.
3038
// We allow disabling perf by setting the env var `RA_DISABLE_PERF`.
@@ -51,7 +59,11 @@ impl StopWatch {
5159
let time = Instant::now();
5260
StopWatch {
5361
time,
54-
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
62+
#[cfg(all(
63+
target_os = "linux",
64+
not(target_env = "ohos"),
65+
any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
66+
))]
5567
counter,
5668
memory,
5769
}
@@ -60,13 +72,19 @@ impl StopWatch {
6072
pub fn elapsed(&mut self) -> StopWatchSpan {
6173
let time = self.time.elapsed();
6274

63-
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
75+
#[cfg(all(
76+
target_os = "linux",
77+
not(target_env = "ohos"),
78+
any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
79+
))]
6480
let instructions = self.counter.as_mut().and_then(|it| {
6581
it.read().map_err(|err| eprintln!("Failed to read perf counter: {err}")).ok()
6682
});
67-
#[cfg(all(target_os = "linux", target_env = "ohos"))]
68-
let instructions = None;
69-
#[cfg(not(target_os = "linux"))]
83+
#[cfg(not(all(
84+
target_os = "linux",
85+
not(target_env = "ohos"),
86+
any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
87+
)))]
7088
let instructions = None;
7189

7290
let memory = MemoryUsage::now() - self.memory;

0 commit comments

Comments
 (0)