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.
489 490 491 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 489 def cg_reader @cg_reader end |
Instance Method Details
#list_available_params ⇒ Array<String>
List available CGroup parameters
483 484 485 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 483 def list_available_params cg_reader.list_available_params end |
#read_params(params) ⇒ Hash
Read selected CGroup parameters
477 478 479 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 477 def read_params(params) cg_reader.read_params(params) end |
#read_stats(params, precise) ⇒ Hash
Read and interpret selected CGroup parameters
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/libosctl/cgroup/path_reader.rb', line 451 def read_stats(params, precise) ret = {} cg_reader.read_stats do 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 end ret end |