diff --git a/.github/workflows/build-dev-auto-feature.yml b/.github/workflows/build-dev-auto-feature.yml index da95549..92f8653 100644 --- a/.github/workflows/build-dev-auto-feature.yml +++ b/.github/workflows/build-dev-auto-feature.yml @@ -34,13 +34,9 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Setup Rust toolchain - uses: actions-rs/toolchain@v2 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal - override: true toolchain: 1.85 - components: rustfmt, clippy - name: Show environment information shell: bash diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 8941ff8..451ab6c 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -37,13 +37,9 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Setup Rust toolchain - uses: actions-rs/toolchain@v2 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal - override: true toolchain: 1.85 - components: rustfmt, clippy - name: Show environment information shell: bash diff --git a/src/perf_event/sampling/group/inner.rs b/src/perf_event/sampling/group/inner.rs index 7850218..f748807 100644 --- a/src/perf_event/sampling/group/inner.rs +++ b/src/perf_event/sampling/group/inner.rs @@ -81,6 +81,7 @@ impl Inner { regs_user_len: perf_event_attr.sample_regs_user.count_ones() as _, #[cfg(feature = "linux-3.19")] regs_intr_len: perf_event_attr.sample_regs_intr.count_ones() as _, + perf_event_attr: perf_event_attr.0, }; let event_id = member.event_id()?; diff --git a/src/perf_event/sampling/single/mod.rs b/src/perf_event/sampling/single/mod.rs index c48cdaa..5dacb2a 100644 --- a/src/perf_event/sampling/single/mod.rs +++ b/src/perf_event/sampling/single/mod.rs @@ -31,8 +31,7 @@ use memmap2::{MmapMut, MmapOptions}; pub use stat::SamplerStat; use crate::{ - config, - config::{Cpu, Error, Process}, + config::{self, Cpu, Error, Process}, infra::WrapResult, sampling::{ record::*, @@ -40,6 +39,7 @@ use crate::{ Config, }, syscall::{bindings::*, ioctl_wrapped, perf_event_open_wrapped}, + RawPerfEventAttr, }; pub struct Sampler { @@ -64,6 +64,8 @@ pub struct Sampler { pub(crate) regs_user_len: usize, #[cfg(feature = "linux-3.19")] pub(crate) regs_intr_len: usize, + + pub(crate) perf_event_attr: RawPerfEventAttr, } impl Sampler { @@ -102,6 +104,7 @@ impl Sampler { regs_user_len: perf_event_attr.sample_regs_user.count_ones() as _, #[cfg(feature = "linux-3.19")] regs_intr_len: perf_event_attr.sample_regs_intr.count_ones() as _, + perf_event_attr: perf_event_attr.0, } .wrap_ok() } @@ -156,4 +159,8 @@ impl Sampler { pub fn get_raw_fd(&self) -> i32 { self.file.as_raw_fd() } + + pub fn perf_event_attr(&self) -> perf_event_attr { + self.perf_event_attr + } } diff --git a/src/perf_event/tracing/tracer/mod.rs b/src/perf_event/tracing/tracer/mod.rs index 22e4f52..10d8feb 100644 --- a/src/perf_event/tracing/tracer/mod.rs +++ b/src/perf_event/tracing/tracer/mod.rs @@ -77,6 +77,7 @@ impl Tracer { regs_user_len: perf_event_attr.sample_regs_user.count_ones() as _, #[cfg(feature = "linux-3.19")] regs_intr_len: perf_event_attr.sample_regs_intr.count_ones() as _, + perf_event_attr: perf_event_attr.0, }; Ok(Self { sampler })