Skip to main content

read_proc_start_time_ns

Function read_proc_start_time_ns 

Source
pub fn read_proc_start_time_ns(pid: u32) -> u64
Expand description

Read the process start time in nanoseconds from /proc/{pid}/stat.

Returns 0 if the process doesn’t exist or parsing fails. The value is jiffies-since-boot converted to nanoseconds.

use proc_tree::proc::read_proc_start_time_ns;

let ns = read_proc_start_time_ns(1);
assert!(ns > 0); // PID 1 always has a start time

assert_eq!(read_proc_start_time_ns(0xFFFF_FFFF), 0); // nonexistent