Module: Vmstat::Stub

Included in:
Vmstat
Defined in:
lib/vmstat/stub.rb

Overview

This is a stub module that should be replaced by system specific implementations of the different functions. This can either be native or with other modules like ProcFS.

Class Method Summary collapse

Class Method Details

.boot_timeTime

Fetches the boot time of the system.

Examples:

Vmstat.boot_time # => 2012-10-09 18:42:37 +0200

Returns:

  • (Time)

    the boot time as regular time object.



10
11
12
# File 'lib/vmstat/stub.rb', line 10

def self.boot_time
  nil
end

.cpuArray<Vmstat::Cpu>

Fetches the cpu statistics (usage counter for user, nice, system and idle)

Examples:

Vmstat.cpu # => [#<struct Vmstat::Cpu ...>, #<struct Vmstat::Cpu ...>]

Returns:



18
19
20
# File 'lib/vmstat/stub.rb', line 18

def self.cpu
  []
end

.disk(path) ⇒ Vmstat::Disk

Fetches the usage data and other useful disk information for the given path.

Examples:

Vmstat.disk("/") # => #<struct Vmstat::Disk type=:hfs, ...>

Parameters:

  • path (String)

    the path (mount point or device path) to the disk

Returns:



27
28
29
# File 'lib/vmstat/stub.rb', line 27

def self.disk(path)
  nil
end

.load_averageVmstat::LoadAverage

Fetches the load average for the current system.

Examples:

Vmstat.load_average # => #<struct Vmstat::LoadAverage one_minute=...>

Returns:



35
36
37
# File 'lib/vmstat/stub.rb', line 35

def self.load_average
  nil
end

.memoryVmstat::Memory

Fetches the memory usage information.

Examples:

Vmstat.memory # => #<struct Vmstat::Memory ...>

Returns:



43
44
45
# File 'lib/vmstat/stub.rb', line 43

def self.memory
  nil
end

.network_interfacesArray<Vmstat::NetworkInterface>

Fetches the information for all available network devices.

Examples:

Vmstat.network_interfaces # => [#<struct Vmstat::NetworkInterface ...>, ...]

Returns:



51
52
53
# File 'lib/vmstat/stub.rb', line 51

def self.network_interfaces
  []
end

.pagesizeFixnum

Fetches pagesize of the current system.

Examples:

Vmstat.pagesize # => 4096

Returns:

  • (Fixnum)

    the pagesize of the current system in bytes.



59
60
61
# File 'lib/vmstat/stub.rb', line 59

def self.pagesize
  4096
end

.taskArray<Vmstat::Task>

Note:

Currently only on Mac OS X

Fetches time and memory usage for the current process.

Examples:

Vmstat.task # => #<struct Vmstat::Task ...>

Returns:



68
69
70
# File 'lib/vmstat/stub.rb', line 68

def self.task
  nil
end