In linux, from
/proc/PID/stat, I can get the
start_time (22:nd) field, which indicates how long after the kernel booted the process was started.
What is a good way to convert that to a seconds-since-the-epoch format? Adding it to the
Basically, I'm looking for the age of the process, not exactly when it was started. My first approach would be to compare the
start_time of the process being investigated with the
start_time of the current process (assuming it has not been running for long).
Surely there must be way better ways.
I didn't find any obvious age-related parameters when looking at https://www.kernel.org/doc/Documentation/filesystems/proc.txt
So, What I have currently is:
process age = (current_utime - ([kernel]btime + [process]start_time))
Any alternative ways that are more efficient from within a shell script? (Ideally correct across DST changes)