From: Daniel Berger Date: 2005-12-09T01:04:40+09:00 Subject: Re: Retrieving PID running time gwtmp01@mac.com wrote: > > On Dec 8, 2005, at 10:14 AM, Philip Rhoades wrote: > >> Yes, but what I want (in Ruby) is something like: >> >> ptime = Process.pid.time >> >> How can I do that? > > > This sort of thing is very platform specific. I'm assuming > a unix/linux/macosx environment. I can't answer for Windows. > > For your own process you can use Process::times, which > probably ends up calling getrusage(), a kernel system > call. See the Ruby doc for Process::times, and your system > docs for getrusage. > > For the general problem of finding the information for > an arbitrary process it becomes more difficult. Some unix > systems make that sort of information available via the > /proc file system. Some make it available via the sysctl > system calls. > > In either case, I don't think there is a standard Ruby library > for parsing /proc or for extracting sysctl values. You would > have to role your own. It's not in the standard library, but there is sys-proctable, available on the RAA. Regards, Dan