class Sys::ProcTable::CgroupEntry
This represents a cgroup entry
Have a look at `man 5 proc` on a linux distribution, to get some more information about the lines and their fields in `/proc//cgroup`.
Example:
entry = CgroupEntry.new '7:devices:/init.scope' entry.hierarchy_id # => 7 entry.subsystems # => ['devices'] entry.control_group # => '/init.scope'
Public Class Methods
new(string)
click to toggle source
Create a new cgroup entry object
This expects a string of '7:devices:/init.scope' - see `man 5 proc` for a reference.
# File lib/linux/sys/proctable/cgroup_entry.rb, line 20 def initialize(string) @string = string.chomp @fields = @string.split(/:/) rescue @fields = [] end
Public Instance Methods
control_group()
click to toggle source
control group in the hierarchy to which the process belongs
# File lib/linux/sys/proctable/cgroup_entry.rb, line 40 def control_group @fields[2] end
hierarchy_id()
click to toggle source
This returns the hierarchy id of the cgroup entry
# File lib/linux/sys/proctable/cgroup_entry.rb, line 28 def hierarchy_id @fields[0].to_i end
subsystems()
click to toggle source
Return sets of subsystems bound to the hierarchy
# File lib/linux/sys/proctable/cgroup_entry.rb, line 33 def subsystems @fields[1].split(/,/) rescue [] end
to_s()
click to toggle source
Return the line itself
# File lib/linux/sys/proctable/cgroup_entry.rb, line 45 def to_s @string end