use super::{
DeviceCertification, Error, OperatingSystemVersion, ProcessInfoThermalState,
ProcessPerformanceProfile,
};
pub struct ProcessInfo {
inner: metal_rust_ffi::ProcessInfo,
}
impl ProcessInfo {
#[must_use]
pub fn current() -> Self {
Self {
inner: metal_rust_ffi::ProcessInfo::current(),
}
}
pub fn set_process_name(&self, name: &str) {
self.inner.set_process_name(name);
}
#[must_use]
pub fn process_identifier(&self) -> i32 {
self.inner.process_identifier()
}
#[must_use]
pub fn operating_system_version(&self) -> OperatingSystemVersion {
self.inner.operating_system_version()
}
#[must_use]
pub fn is_operating_system_at_least(&self, version: &OperatingSystemVersion) -> bool {
self.inner.is_operating_system_at_least(version)
}
#[must_use]
pub fn processor_count(&self) -> usize {
self.inner.processor_count()
}
#[must_use]
pub fn active_processor_count(&self) -> usize {
self.inner.active_processor_count()
}
#[must_use]
pub fn physical_memory(&self) -> u64 {
self.inner.physical_memory()
}
#[must_use]
pub fn system_uptime(&self) -> f64 {
self.inner.system_uptime()
}
pub fn disable_sudden_termination(&self) {
self.inner.disable_sudden_termination();
}
pub fn enable_sudden_termination(&self) {
self.inner.enable_sudden_termination();
}
#[must_use]
pub fn automatic_termination_support_enabled(&self) -> bool {
self.inner.automatic_termination_support_enabled()
}
pub fn set_automatic_termination_support_enabled(&self, enabled: bool) {
self.inner
.set_automatic_termination_support_enabled(enabled);
}
#[must_use]
pub fn thermal_state(&self) -> ProcessInfoThermalState {
self.inner.thermal_state()
}
#[must_use]
pub fn is_low_power_mode_enabled(&self) -> bool {
self.inner.is_low_power_mode_enabled()
}
#[must_use]
pub fn is_ios_app_on_mac(&self) -> bool {
self.inner.is_ios_app_on_mac()
}
#[must_use]
pub fn is_mac_catalyst_app(&self) -> bool {
self.inner.is_mac_catalyst_app()
}
pub fn is_device_certified(&self, tier: DeviceCertification) -> Result<bool, Error> {
self.inner
.is_device_certified(tier.as_raw())
.map_err(Error::from_ffi)
}
pub fn has_performance_profile(
&self,
profile: ProcessPerformanceProfile,
) -> Result<bool, Error> {
self.inner
.has_performance_profile(profile.as_raw())
.map_err(Error::from_ffi)
}
}