#![allow(non_upper_case_globals)]
use core::fmt;
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PerfHeaderIndex(pub u8);
impl PerfHeaderIndex {
pub const Reserved: Self = Self(0);
pub const TracingData: Self = Self(1);
pub const FirstFeature: Self = Self(1);
pub const BuildId: Self = Self(2);
pub const Hostname: Self = Self(3);
pub const OSRelease: Self = Self(4);
pub const Version: Self = Self(5);
pub const Arch: Self = Self(6);
pub const NrCpus: Self = Self(7);
pub const CpuDesc: Self = Self(8);
pub const CpuId: Self = Self(9);
pub const TotalMem: Self = Self(10);
pub const Cmdline: Self = Self(11);
pub const EventDesc: Self = Self(12);
pub const CpuTopology: Self = Self(13);
pub const NumaTopology: Self = Self(14);
pub const BranchStack: Self = Self(15);
pub const PmuMappings: Self = Self(16);
pub const GroupDesc: Self = Self(17);
pub const AuxTrace: Self = Self(18);
pub const Stat: Self = Self(19);
pub const Cache: Self = Self(20);
pub const SampleTime: Self = Self(21);
pub const MemTopology: Self = Self(22);
pub const ClockId: Self = Self(23);
pub const DirFormat: Self = Self(24);
pub const BpfProgInfo: Self = Self(25);
pub const BpfBtf: Self = Self(26);
pub const Compressed: Self = Self(27);
pub const CpuPmuCaps: Self = Self(28);
pub const ClockData: Self = Self(29);
pub const HybridTopology: Self = Self(30);
pub const PmuCaps: Self = Self(31);
pub const LastFeature: Self = Self(32);
pub const fn as_string(self) -> Option<&'static str> {
const NAMES: [&str; 33] = [
"Reserved",
"TracingData",
"BuildId",
"Hostname",
"OSRelease",
"Version",
"Arch",
"NrCpus",
"CpuDesc",
"CpuId",
"TotalMem",
"Cmdline",
"EventDesc",
"CpuTopology",
"NumaTopology",
"BranchStack",
"PmuMappings",
"GroupDesc",
"AuxTrace",
"Stat",
"Cache",
"SampleTime",
"MemTopology",
"ClockId",
"DirFormat",
"BpfProgInfo",
"BpfBtf",
"Compressed",
"CpuPmuCaps",
"ClockData",
"HybridTopology",
"PmuCaps",
"LastFeature",
];
let index = self.0 as usize;
if index < NAMES.len() {
return Some(NAMES[index]);
} else {
return None;
}
}
}
impl From<u8> for PerfHeaderIndex {
fn from(val: u8) -> Self {
Self(val)
}
}
impl From<PerfHeaderIndex> for u8 {
fn from(val: PerfHeaderIndex) -> Self {
val.0
}
}
impl fmt::Display for PerfHeaderIndex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(s) = self.as_string() {
return f.pad(s);
} else {
return self.0.fmt(f);
}
}
}