MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / read_process_rusage

Function read_process_rusage

packages/server/src/performance.rs:968–986  ·  view source on GitHub ↗
(pid: i32)

Source from the content-addressed store, hash-verified

966
967#[cfg(target_os = "macos")]
968fn read_process_rusage(pid: i32) -> Option<ProcessRUsage> {
969 let mut info = RUsageInfoV6::default();
970 let result = unsafe {
971 proc_pid_rusage(
972 pid,
973 RUSAGE_INFO_V6,
974 &mut info as *mut RUsageInfoV6 as *mut c_void,
975 )
976 };
977 (result == 0).then_some(ProcessRUsage {
978 user_time_ns: info.ri_user_time,
979 system_time_ns: info.ri_system_time,
980 resident_size: info.ri_resident_size,
981 phys_footprint: info.ri_phys_footprint,
982 lifetime_max_phys_footprint: info.ri_lifetime_max_phys_footprint,
983 disk_read_bytes: info.ri_diskio_bytesread,
984 disk_write_bytes: info.ri_diskio_byteswritten,
985 })
986}
987
988#[cfg(not(target_os = "macos"))]
989fn read_process_rusage(_pid: i32) -> Option<ProcessRUsage> {

Callers 1

sample_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected