//! PMU (Performance Monitoring Unit) counters via Apple's kpc interface.
//!
//! Requires running as root **or** with the `dtrace_proc` entitlement
//! (the Instruments profiler uses the same mechanism). On stock macOS
//! without SIP changes this will fail with [`crate::CpuError::PmuNotAvailable`].
use crateCpuError;
use ;
// ---------------------------------------------------------------------------
// Counter enum
// ---------------------------------------------------------------------------
/// Which hardware event to count.
// ---------------------------------------------------------------------------
// Snapshot / Counts
// ---------------------------------------------------------------------------
/// Raw counter values captured at a single point in time.
/// Human-readable delta between two [`Snapshot`]s.
// ---------------------------------------------------------------------------
// PMU event numbers (Apple Silicon, may vary by generation)
// ---------------------------------------------------------------------------
/// Map our Counter enum to the Apple PMU event selector.
///
/// These selectors are for M1โM4; they live in configurable counter
/// config words as `(event << 0)`. Fixed counters (0 = cycles,
/// 1 = instructions) are always present.
// ---------------------------------------------------------------------------
// Counters
// ---------------------------------------------------------------------------
/// Handle to an active PMU counting session.
///
/// # Example
///
/// ```no_run
/// use acpu::pulse::{Counter, Counters};
///
/// let mut ctx = Counters::new(&[Counter::Cycles, Counter::Instructions]).unwrap();
/// ctx.start();
/// // ... workload ...
/// let a = ctx.read();
/// // ... more workload ...
/// let b = ctx.read();
/// ctx.stop();
/// let c = ctx.elapsed(&a, &b);
/// println!("IPC = {:.2}", c.instructions as f64 / c.cycles as f64);
/// ```
Homonyms
cyb/evy/forks/naga/src/back/hlsl/mod.rs
struct Baz { m: mat3x2, } struct Baz { float2 m_0; float2 m_1; float2 m_2; }; float3x2 GetMatmOnBaz(Baz obj) { return float3x2(obj.m_0, obj.m_1, obj.m_2); }