Class: OsCtl::Lib::CGroup::PathReader
- Inherits:
-
Object
- Object
- OsCtl::Lib::CGroup::PathReader
- Defined in:
- lib/libosctl/cgroup/path_reader.rb
Overview
Version-agnostic interface for reading CGroup parameters
Defined Under Namespace
Instance Attribute Summary collapse
-
#cg_reader ⇒ Object
readonly
protected
Returns the value of attribute cg_reader.
Instance Method Summary collapse
-
#initialize(subsystems, path) ⇒ PathReader
constructor
A new instance of PathReader.
-
#list_available_params ⇒ Array<String>
List available CGroup parameters.
-
#read_params(params) ⇒ Hash
Read selected CGroup parameters.
-
#read_stats(params, precise) ⇒ Hash
Read and interpret selected CGroup parameters.
Constructor Details
Instance Attribute Details
#cg_reader ⇒ Object (readonly, protected)
Returns the value of attribute cg_reader.
432 433 434 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 432 def cg_reader @cg_reader end |
Instance Method Details
#list_available_params ⇒ Array<String>
List available CGroup parameters
426 427 428 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 426 def list_available_params cg_reader.list_available_params end |
#read_params(params) ⇒ Hash
Read selected CGroup parameters
420 421 422 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 420 def read_params(params) cg_reader.read_params(params) end |
#read_stats(params, precise) ⇒ Hash
Read and interpret selected CGroup parameters
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 396 def read_stats(params, precise) ret = {} params.each do |field| next if ret[field] v = cg_reader.read_stats_param(field, precise) next if v.nil? if v.is_a?(Hash) ret.update(v) else ret[field] = v end rescue Errno::ENOENT ret[field] = nil end ret end |