From 76322b2f6388e6874b1b7666c4b6fda063291179 Mon Sep 17 00:00:00 2001 From: Thaumy Date: Wed, 20 Mar 2024 14:39:21 +0800 Subject: [PATCH] add `into_fixed` fn for groups --- src/perf_event/counting/group/mod.rs | 4 ++++ src/perf_event/sampling/group/mod.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/perf_event/counting/group/mod.rs b/src/perf_event/counting/group/mod.rs index 4d0f53a..1de1df6 100644 --- a/src/perf_event/counting/group/mod.rs +++ b/src/perf_event/counting/group/mod.rs @@ -87,4 +87,8 @@ impl CounterGroup { pub fn stat(&mut self) -> io::Result { self.inner_mut().stat() } + + pub fn into_fixed(self) -> io::Result { + FixedCounterGroup::new(self.inner).wrap_ok() + } } diff --git a/src/perf_event/sampling/group/mod.rs b/src/perf_event/sampling/group/mod.rs index 73d56f4..eda8a48 100644 --- a/src/perf_event/sampling/group/mod.rs +++ b/src/perf_event/sampling/group/mod.rs @@ -84,4 +84,8 @@ impl SamplerGroup { pub fn stat(&mut self) -> io::Result { self.inner_mut().stat() } + + pub fn into_fixed(self) -> io::Result { + FixedSamplerGroup::new(self.inner).wrap_ok() + } }