pub enum SamplerError {
Show 17 variants
Load(LoadError),
Framework(FrameworkError),
InvalidCpuName,
UnknownCpu(String),
EventUnavailable(Event),
EventLayoutMismatch {
expected: usize,
actual: usize,
},
UnexpectedNullPointer,
MissingPrivileges,
FailedToForceAllCounters(c_int),
FailedToSetKpcConfig(c_int),
UnableToStartCounting(c_int),
UnableToStopCounting(c_int),
UnableToStartThreadCounting(c_int),
UnableToStopThreadCounting(c_int),
UnableToReadCounters(c_int),
UnableToResetControl(c_int),
SamplerNotRunning,
}Expand description
An error from the Sampler API.
Variants§
Load(LoadError)
Failed to load a framework via dlopen/dlsym.
Framework(FrameworkError)
A kperfdata.framework (KPEP) operation failed.
InvalidCpuName
The PMC database name is not valid UTF-8.
UnknownCpu(String)
The detected CPU is not recognized by this build.
An event is not available on the detected CPU.
EventLayoutMismatch
The framework’s kpep_event struct size does not match our definition.
UnexpectedNullPointer
A framework function returned a null pointer where non-null was expected.
MissingPrivileges
Insufficient privileges to access performance counters.
Run with sudo or sign the binary with the
com.apple.private.kernel.kpc entitlement.
FailedToForceAllCounters(c_int)
Failed to force-acquire all hardware counters.
FailedToSetKpcConfig(c_int)
Failed to set KPC register configuration.
UnableToStartCounting(c_int)
Failed to enable counting.
UnableToStopCounting(c_int)
Failed to disable counting.
UnableToStartThreadCounting(c_int)
Failed to enable per-thread counting.
UnableToStopThreadCounting(c_int)
Failed to disable per-thread counting.
UnableToReadCounters(c_int)
Failed to read thread counters.
UnableToResetControl(c_int)
Failed to release force-acquired counters during teardown.
SamplerNotRunning
Attempted to sample while counting is not enabled.
Trait Implementations§
Source§impl Debug for SamplerError
impl Debug for SamplerError
Source§impl Display for SamplerError
impl Display for SamplerError
Source§impl Error for SamplerError
impl Error for SamplerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()