diff --git a/src/perf_event/counting/group/mod.rs b/src/perf_event/counting/group/mod.rs index 4d0f53a..9fbdf6e 100644 --- a/src/perf_event/counting/group/mod.rs +++ b/src/perf_event/counting/group/mod.rs @@ -81,10 +81,14 @@ impl CounterGroup { pub fn enable(self) -> io::Result { self.inner_mut().enable()?; - FixedCounterGroup::new(self.inner).wrap_ok() + self.into_fixed() } 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..a58beeb 100644 --- a/src/perf_event/sampling/group/mod.rs +++ b/src/perf_event/sampling/group/mod.rs @@ -74,7 +74,7 @@ impl SamplerGroup { pub fn enable(self) -> io::Result { self.inner().enable()?; - FixedSamplerGroup::new(self.inner).wrap_ok() + self.into_fixed() } pub fn next_record(&self, guard: &SamplerGuard) -> Option { @@ -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() + } }