process usage

A

ara.t.howard

long ago i recall a library the collected process usage, memory and
such, in a platform independent way (at least across unices). does
anyone else recall this lib?

link?

cheers.

a @ http://drawohara.com/
 
A

ara.t.howard

gem install sys-proctable

http://www.rubyforge.org/projects/sysutils

Works on MS Windows, too.

Regards,

Dan

irb(main):005:0> ProcTable.ps(Process.pid)
=> #<struct Struct::procTableStruct pid=13848, ppid=22238,
pgid=13848, ruid=501, rgid=501, comm="ruby", state="run", pctcpu=0.0,
cpu_num=nil, tty_num=67108877, tty_dev="ttypd", wchan="", time=0,
priority=24, usr_priority=0, nice=0, cmdline="", start_time=Fri Sep
28 11:19:38 -0600 2007, max_rss=nil, ix_rss=nil, id_rss=nil,
is_rss=nil, minflt=nil, maxflt=nil, nswap=nil, inblock=nil,
oublock=nil, msgsnd=nil, msgrcv=nil, nsignals=nil, nvcsw=nil,
nivcsw=nil, user_time=nil, system_time=nil>


nothing memory-ish looking in there is there? i'm on darwin - no rss
support there?

cheers.

a @ http://drawohara.com/
 
E

Eric Hodel

irb(main):005:0> ProcTable.ps(Process.pid)
=> #<struct Struct::procTableStruct pid=13848, ppid=22238,
pgid=13848, ruid=501, rgid=501, comm="ruby", state="run",
pctcpu=0.0, cpu_num=nil, tty_num=67108877, tty_dev="ttypd",
wchan="", time=0, priority=24, usr_priority=0, nice=0, cmdline="",
start_time=Fri Sep 28 11:19:38 -0600 2007, max_rss=nil, ix_rss=nil,
id_rss=nil, is_rss=nil, minflt=nil, maxflt=nil, nswap=nil,
inblock=nil, oublock=nil, msgsnd=nil, msgrcv=nil, nsignals=nil,
nvcsw=nil, nivcsw=nil, user_time=nil, system_time=nil>


nothing memory-ish looking in there is there? i'm on darwin - no
rss support there?

Yes, they left a bunch of that stuff out, or don't supply it via the
BSD-ish interfaces they've got.

Also, some limits you set will have no effect, notably the various
memory size ones.
 
A

ara.t.howard

Yes, they left a bunch of that stuff out, or don't supply it via
the BSD-ish interfaces they've got.

Also, some limits you set will have no effect, notably the various
memory size ones.

good to know. now i'm using this, which uses the same shell over and
over rather than starting a new one:

cfp:~ > cat a.rb
require 'session' # gem install session

module Process
def self.size pid = Process.pid
@sh = Session.new
@sh.execute "ps wwwaux -p #{ pid }", :stdout => stdout=[]
vsize, rsize = stdout.last.split(%r/\s+/)[4,2]
end
end

p Process.size


cfp:~ > ruby a.rb
["31052", "3388"]




a @ http://drawohara.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,329
Latest member
InezZ76898

Latest Threads

Top