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.2.7'

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,
  :steal      => 0,
  :guest      => 1162987977,
  :guest_nice => 0
}

kstat[:processes] # => 1299560


45
46
47
# File 'lib/linux/kstat.rb', line 45

def initialize
  @hash = get_proc_stat_info
end