use bitflags::bitflags;
use crate::sys::bindings;
use crate::Builder;
used_in_docs!(Builder);
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum SampleSkid {
Arbitrary = 0,
Constant = 1,
RequestZero = 2,
RequireZero = 3,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[repr(transparent)]
pub struct Clock(libc::clockid_t);
impl Clock {
pub const TAI: Self = Self::new(libc::CLOCK_TAI);
pub const REALTIME: Self = Self::new(libc::CLOCK_REALTIME);
pub const BOOTTIME: Self = Self::new(libc::CLOCK_BOOTTIME);
pub const MONOTONIC: Self = Self::new(libc::CLOCK_MONOTONIC);
pub const MONOTONIC_RAW: Self = Self::new(libc::CLOCK_MONOTONIC_RAW);
}
impl Clock {
pub const fn new(clockid: libc::clockid_t) -> Self {
Self(clockid)
}
pub const fn into_raw(self) -> libc::clockid_t {
self.0
}
}
bitflags! {
pub struct SampleBranchFlag: u64 {
const USER = bindings::PERF_SAMPLE_BRANCH_USER as _;
const KERNEL = bindings::PERF_SAMPLE_BRANCH_KERNEL as _;
const HV = bindings::PERF_SAMPLE_BRANCH_HV as _;
const ANY = bindings::PERF_SAMPLE_BRANCH_ANY as _;
const ANY_CALL = bindings::PERF_SAMPLE_BRANCH_ANY_CALL as _;
const IND_CALL = bindings::PERF_SAMPLE_BRANCH_IND_CALL as _;
const CALL = bindings::PERF_SAMPLE_BRANCH_CALL as _;
const ANY_RETURN = bindings::PERF_SAMPLE_BRANCH_ANY_RETURN as _;
const IND_JUMP = bindings::PERF_SAMPLE_BRANCH_IND_JUMP as _;
const COND = bindings::PERF_SAMPLE_BRANCH_COND as _;
const ABORT_TX = bindings::PERF_SAMPLE_BRANCH_ABORT_TX as _;
const IN_TX = bindings::PERF_SAMPLE_BRANCH_IN_TX as _;
const NO_TX = bindings::PERF_SAMPLE_BRANCH_NO_TX as _;
const CALL_STACK = bindings::PERF_SAMPLE_BRANCH_CALL_STACK as _;
}
}
impl SampleBranchFlag {
pub const PLM_ALL: Self = Self::USER.union(Self::KERNEL).union(Self::HV);
}
bitflags! {
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)]
pub struct ReadFormat : u64 {
const TOTAL_TIME_ENABLED = bindings::PERF_FORMAT_TOTAL_TIME_ENABLED as _;
const TOTAL_TIME_RUNNING = bindings::PERF_FORMAT_TOTAL_TIME_RUNNING as _;
const ID = bindings::PERF_FORMAT_ID as _;
const GROUP = bindings::PERF_FORMAT_GROUP as _;
const LOST = bindings::PERF_FORMAT_LOST as _;
}
}