Skip to main content

Database

Struct Database 

Source
pub struct Database<'db> { /* private fields */ }
Available on macOS only.
Expand description

Safe, read-only view of a kpep_db opened by the framework.

Each database describes every PMC event that a specific Apple Silicon CPU supports. The 'db lifetime is tied to the framework-allocated database; all string and event pointers inside the database remain valid for this lifetime.

Implementations§

Source§

impl<'db> Database<'db>

Source

pub const unsafe fn as_raw(&self) -> NonNull<kpep_db>

Returns a non-null pointer to the underlying kpep_db.

This is useful if you need to call kperfdata.framework functions directly through the VTable.

§Safety

The returned pointer borrows the database. The caller must not mutate it, free it, or use it after the Database’s lifetime has expired.

Source

pub const fn name(&self) -> &'db str

Database name, e.g. "a14", "as4".

Source

pub const fn cpu_id(&self) -> &'db str

Plist CPU identifier, e.g. "cpu_7_8_10b282dc".

Source

pub const fn cpu(&self) -> Option<Cpu>

The Cpu corresponding to this database.

Source

pub const fn marketing_name(&self) -> &'db str

Marketing name, e.g. "Apple A14/M1".

Source

pub const fn events(&self) -> &'db [DatabaseEvent<'db>]

All events in the database.

Source

pub const fn fixed_events(&self) -> &'db [&'db DatabaseEvent<'db>]

Events assigned to fixed counter registers.

Each element is a reference into the events array.

Source

pub const fn architecture(&self) -> Architecture

The CPU architecture this database targets.

Auto Trait Implementations§

§

impl<'db> Freeze for Database<'db>

§

impl<'db> RefUnwindSafe for Database<'db>

§

impl<'db> !Send for Database<'db>

§

impl<'db> !Sync for Database<'db>

§

impl<'db> Unpin for Database<'db>

§

impl<'db> UnsafeUnpin for Database<'db>

§

impl<'db> UnwindSafe for Database<'db>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.