Class: Vmstat::Memory

Inherits:
Struct
  • Object
show all
Defined in:
lib/vmstat/memory.rb

Overview

Gathered memory data snapshot.

Direct Known Subclasses

LinuxMemory

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activeFixnum

The number of active pages in the system.

Returns:

  • (Fixnum)

    the current value of active



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def active
  @active
end

#freeFixnum

The number of free pages in the system.

Returns:

  • (Fixnum)

    the current value of free



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def free
  @free
end

#inactiveFixnum

The number of inactive pages in the system.

Returns:

  • (Fixnum)

    the current value of inactive



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def inactive
  @inactive
end

#pageinsFixnum

The number of pageins.

Returns:

  • (Fixnum)

    the current value of pageins



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def pageins
  @pageins
end

#pageoutsFixnum

The number of pageouts.

Returns:

  • (Fixnum)

    the current value of pageouts



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def pageouts
  @pageouts
end

#pagesizeFixnum

The page size of the memory in bytes.

Returns:

  • (Fixnum)

    the current value of pagesize



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def pagesize
  @pagesize
end

#wiredFixnum

The number of wired pages in the system.

Returns:

  • (Fixnum)

    the current value of wired



17
18
19
# File 'lib/vmstat/memory.rb', line 17

def wired
  @wired
end

Instance Method Details

#active_bytesFixnum

Calculate the active bytes based of the active pages.

Returns:

  • (Fixnum)

    active bytes



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

def active_bytes
  active * pagesize
end

#free_bytesFixnum

Calculate the free bytes based of the free pages.

Returns:

  • (Fixnum)

    free bytes



39
40
41
# File 'lib/vmstat/memory.rb', line 39

def free_bytes
  free * pagesize
end

#inactive_bytesFixnum

Calculate the inactive bytes based of the inactive pages.

Returns:

  • (Fixnum)

    inactive bytes



33
34
35
# File 'lib/vmstat/memory.rb', line 33

def inactive_bytes
  inactive * pagesize
end

#total_bytesFixnum

Calculate the total bytes based of all pages

Returns:

  • (Fixnum)

    total bytes



45
46
47
# File 'lib/vmstat/memory.rb', line 45

def total_bytes
  (wired + active + inactive + free) * pagesize
end

#wired_bytesFixnum

Calculate the wired bytes based of the wired pages.

Returns:

  • (Fixnum)

    wired bytes



21
22
23
# File 'lib/vmstat/memory.rb', line 21

def wired_bytes
  wired * pagesize
end