From: Joe Van Dyk Date: 2005-12-09T02:49:09+09:00 Subject: Re: Retrieving PID running time On 12/8/05, Philip Rhoades wrote: > On Fri, 2005-12-09 at 00:03 +0900, Joe Van Dyk wrote: > > On 12/8/05, Philip Rhoades wrote: > > > People, > > > > > > I have found how to get PIDs etc but how can I find the running time of > > > a particular PID without messing around with a system call to ps etc > > > > That information should be in /proc//stat. Look at the man page > > for proc for more details. > > Yes, but what I want (in Ruby) is something like: > > ptime = Process.pid.time untested: class Process def meth_missing pid, *args get_process_info(pid)[args.first] end def get_process_info pid # parse /proc//stat, put values you want into some struct and return it end end