Skip to content

Commit

Permalink
feat(common-pprof): Build guard using code in pprof-rs's example
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Jun 5, 2023
1 parent 740269d commit a69389f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common/pprof/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ impl Profiling {

/// Profiles and returns a generated pprof report.
pub async fn report(&self) -> Result<pprof::Report> {
let guard = pprof::ProfilerGuard::new(self.frequency).context(CreateGuardSnafu)?;
let guard = pprof::ProfilerGuardBuilder::default()
.frequency(self.frequency)
.blocklist(&["libc", "libgcc", "pthread", "vdso"])
.build()
.context(CreateGuardSnafu)?;
tokio::time::sleep(self.duration).await;
guard.report().build().context(CreateReportSnafu)
}
Expand Down

0 comments on commit a69389f

Please sign in to comment.