| 966 | |
| 967 | #[cfg(target_os = "macos")] |
| 968 | fn 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"))] |
| 989 | fn read_process_rusage(_pid: i32) -> Option<ProcessRUsage> { |