Skip to content

Commit

Permalink
add into_fixed fn for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaumy committed Mar 21, 2024
1 parent 1682462 commit cf8ac51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/perf_event/counting/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ impl CounterGroup {

pub fn enable(self) -> io::Result<FixedCounterGroup> {
self.inner_mut().enable()?;
FixedCounterGroup::new(self.inner).wrap_ok()
self.into_fixed()
}

pub fn stat(&mut self) -> io::Result<CounterGroupStat> {
self.inner_mut().stat()
}

pub fn into_fixed(self) -> io::Result<FixedCounterGroup> {
FixedCounterGroup::new(self.inner).wrap_ok()
}
}
6 changes: 5 additions & 1 deletion src/perf_event/sampling/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SamplerGroup {

pub fn enable(self) -> io::Result<FixedSamplerGroup> {
self.inner().enable()?;
FixedSamplerGroup::new(self.inner).wrap_ok()
self.into_fixed()
}

pub fn next_record(&self, guard: &SamplerGuard) -> Option<Record> {
Expand All @@ -84,4 +84,8 @@ impl SamplerGroup {
pub fn stat(&mut self) -> io::Result<SamplerGroupStat> {
self.inner_mut().stat()
}

pub fn into_fixed(self) -> io::Result<FixedSamplerGroup> {
FixedSamplerGroup::new(self.inner).wrap_ok()
}
}

0 comments on commit cf8ac51

Please sign in to comment.