Class: OsCtl::Lib::CGroup::PathReader::Base
- Inherits:
- 
      Object
      
        - Object
- OsCtl::Lib::CGroup::PathReader::Base
 
- Includes:
- Utils::Humanize
- Defined in:
- lib/libosctl/cgroup/path_reader.rb
Instance Attribute Summary collapse
- 
  
    
      #cache  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  protected
  
  
  
  
    Returns the value of attribute cache. 
Instance Method Summary collapse
- #cache_param(path, name) ⇒ Object protected
- 
  
    
      #initialize  ⇒ Base 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Base. 
- #meminfo ⇒ Object protected
- #read_stats ⇒ Object
Methods included from Utils::Humanize
#break_interval, #format_long_duration, #format_percent, #format_short_duration, #humanize_data, #humanize_number, #humanize_percent, #humanize_time_ns, #humanize_time_us, #parse_data
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
| 7 8 9 | # File 'lib/libosctl/cgroup/path_reader.rb', line 7 def initialize @cache = {} end | 
Instance Attribute Details
#cache ⇒ Object (readonly, protected)
Returns the value of attribute cache.
| 20 21 22 | # File 'lib/libosctl/cgroup/path_reader.rb', line 20 def cache @cache end | 
Instance Method Details
#cache_param(path, name) ⇒ Object (protected)
| 26 27 28 29 30 31 32 33 34 35 36 | # File 'lib/libosctl/cgroup/path_reader.rb', line 26 def cache_param(path, name) path_cache = cache[path] if path_cache name_cache = path_cache[name] return name_cache if name_cache end cache[path] ||= {} cache[path][name] = yield(path, name) end | 
#meminfo ⇒ Object (protected)
| 22 23 24 | # File 'lib/libosctl/cgroup/path_reader.rb', line 22 def meminfo @@meminfo ||= MemInfo.new end | 
#read_stats ⇒ Object
| 11 12 13 14 15 16 | # File 'lib/libosctl/cgroup/path_reader.rb', line 11 def read_stats @cpu_limit = nil @memory_limit = nil @memory_usage = nil yield end |