#![allow(clippy::too_many_arguments, reason = "buildstructor")]
#![allow(
unexpected_cfgs,
reason = "https://github.com/BrynCooke/buildstructor/issues/192"
)]
use std::borrow::Cow;
use std::path::PathBuf;
#[cfg(feature = "profile-folding")]
use inferno::collapse::perf::Options as PerfOptions;
#[cfg(feature = "profile-folding")]
type FlamegraphOptions = inferno::flamegraph::Options<'static>;
pub type CowStr = Cow<'static, str>;
#[derive(Clone, buildstructor::Builder)]
#[non_exhaustive] pub struct TracingOptions {
pub frequency: u32,
pub samply_outfile: Option<PathBuf>,
pub perf_raw_outfile: Option<PathBuf>,
pub fold_outfile: Option<PathBuf>,
#[cfg(feature = "profile-folding")]
pub fold_perf_options: Option<PerfOptions>,
pub flamegraph_outfile: Option<PathBuf>,
#[cfg(feature = "profile-folding")]
pub flamegraph_options: Option<fn() -> FlamegraphOptions>,
pub setup_command: Option<CowStr>,
}
pub const DEBIAN_PERF_SETUP_COMMAND: &str = "sudo sh -c 'apt update && apt install -y linux-perf binutils && echo -1 > /proc/sys/kernel/perf_event_paranoid && echo 0 > /proc/sys/kernel/kptr_restrict'";
pub const AL2_PERF_SETUP_COMMAND: &str = "sudo sh -c 'yum install -y perf && echo -1 > /proc/sys/kernel/perf_event_paranoid && echo 0 > /proc/sys/kernel/kptr_restrict'";
pub const AL2023_PERF_SETUP_COMMAND: &str = "sudo sh -c 'dnf update -y && dnf install perf -y && echo -1 > /proc/sys/kernel/perf_event_paranoid && echo 0 > /proc/sys/kernel/kptr_restrict'";