From 80567bfd70240b120e9517c3b0e7d90cff96e8c8 Mon Sep 17 00:00:00 2001 From: LuuuXXX Date: Thu, 21 Nov 2024 09:16:11 +0800 Subject: [PATCH] update perf-event-open-sys to perf-event-open-sys2 --- Cargo.toml | 2 +- measureme/Cargo.toml | 2 +- measureme/src/counters.rs | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 130c455..a0b45dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ measureme_10 = { version = "10.1.3", package = "measureme" } memchr = "2" memmap2 = "0.2.1" parking_lot = "0.12.0" -perf-event-open-sys = "3.0.0" +perf-event-open-sys2 = "5.0.6" prettytable-rs = "0.10" rustc-hash = "1.0.1" serde = { version = "1.0", features = ["derive"] } diff --git a/measureme/Cargo.toml b/measureme/Cargo.toml index 9c9f879..5e67442 100644 --- a/measureme/Cargo.toml +++ b/measureme/Cargo.toml @@ -18,4 +18,4 @@ nightly = [] [target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies] memmap2.workspace = true -perf-event-open-sys.workspace = true +perf-event-open-sys2.workspace = true diff --git a/measureme/src/counters.rs b/measureme/src/counters.rs index f513527..dd9cd64 100644 --- a/measureme/src/counters.rs +++ b/measureme/src/counters.rs @@ -349,12 +349,10 @@ mod hw { type_: perf_type_id, hw_id: u32, ) -> Result> { - let mut attrs = perf_event_attr { - size: mem::size_of::().try_into().unwrap(), - type_, - config: hw_id.into(), - ..perf_event_attr::default() - }; + let mut attrs = perf_event_attr::default(); + attrs.size = mem::size_of::().try_into().unwrap(); + attrs.type_ = type_; + attrs.config = hw_id.into(); // Only record same-thread, any CPUs, and only userspace (no kernel/hypervisor). // NOTE(eddyb) `pid = 0`, despite talking about "process id", means