Class: Linux::Kstat

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/linux/kstat.rb

Overview

The Kstat class encapsulates Linux kernel statistics derived from /proc/stat.

Constant Summary collapse

VERSION =

The version of the linux-kstat library

'0.1.0'

Instance Method Summary collapse

Constructor Details

#initializeKstat

Create a new Linux::Kstat instance. You can access the information stored in this object the same way you would access a hash key. Note that all keys are symbols.

Example:

kstat = Linux::Kstat.new

kstat[:cpu] => {
  :idle     => 250713454,
  :iowait   => 2745691,
  :irq      => 39717,
  :softirq  => 31323,
  :system   => 1881655,
  :nice     => 117158,
  :user     => 7137418
}

kstat[:processes] # => 1299560


40
41
42
# File 'lib/linux/kstat.rb', line 40

def initialize
  @hash = get_proc_stat_info
end