| Path: | sys_proctable.html |
| Last Update: | Thu Nov 23 07:48:08 -0700 2006 |
A Ruby interface for getting process information.
require 'sys/proctable'
include Sys
# Everything
ProcTable.ps{ |p|
puts p.pid.to_s
puts p.comm
...
}
or
# Just one process
s = ProcTable.ps(2123)
puts s.pid.to_s
puts s.comm
...
# Return the results as an array of ProcTableStructs
a = ProcTable.ps
a.each do |p|
puts a.pid
...
end
VERSION
Returns the current version number for this package (as a string).
ProcTable.fields
Returns an array of fields available on the current OS.
ProcTable.ps(pid=nil)
ProcTable.ps{ |s| … }
If no pid is included as an argument, in block form it returns a struct of type ProcTableStruct for every process in the proc table. Otherwise it returns an array of ProcTable struct's. If a pid is provided it will return a single ProcTable struct for that pid, or nil if it is not found.
You can view the supported fields with the "fields()" class method. However, all platforms share a cmdline and comm field.
Add support for more platforms, e.g. AIX, IRIX, etc.
None that I am aware of. Please log any bugs on the RubyForge project page at http://www.rubyforge.org/projects/sysutils
Ruby's
(C) 2003-2006 Daniel J. Berger
All Rights Reserved.
This package is provided "as is" and without any exblockquotess or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
Daniel J. Berger
djberg96 at nospam at gmail dot com
imperator on IRC (Freenode)
ps, proc