Class: Vmstator::Memory

Inherits:
Stats
  • Object
show all
Defined in:
lib/vmstator/memory.rb

Direct Known Subclasses

ActiveMemory, AverageMemory

Instance Attribute Summary collapse

Attributes inherited from Stats

#data

Instance Method Summary collapse

Methods inherited from Stats

#initialize

Constructor Details

This class inherits a constructor from Vmstator::Stats

Instance Attribute Details

#blocks_recvObject (readonly)

blocks received from a device (blocks/s)



12
13
14
# File 'lib/vmstator/memory.rb', line 12

def blocks_recv
  @blocks_recv
end

#blocks_sentObject (readonly)

blocks sent to a block device (blocks/s)



13
14
15
# File 'lib/vmstator/memory.rb', line 13

def blocks_sent
  @blocks_sent
end

#bufferObject (readonly)

amount of memory used as buffers



8
9
10
# File 'lib/vmstator/memory.rb', line 8

def buffer
  @buffer
end

#cacheObject (readonly)

amount of memory used as cache



9
10
11
# File 'lib/vmstator/memory.rb', line 9

def cache
  @cache
end

#cntxt_swtchsObject (readonly)

number of context switches (/s)



15
16
17
# File 'lib/vmstator/memory.rb', line 15

def cntxt_swtchs
  @cntxt_swtchs
end

#freeObject (readonly)

amount of idle memory



7
8
9
# File 'lib/vmstator/memory.rb', line 7

def free
  @free
end

#idle_timeObject (readonly)

time spent idle



18
19
20
# File 'lib/vmstator/memory.rb', line 18

def idle_time
  @idle_time
end

#interruptsObject (readonly)

number of interrupts (/s)



14
15
16
# File 'lib/vmstator/memory.rb', line 14

def interrupts
  @interrupts
end

#kernelObject (readonly)

time spent running kernel code



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

def kernel
  @kernel
end

#non_kernelObject (readonly)

time spent running non-kernel code



16
17
18
# File 'lib/vmstator/memory.rb', line 16

def non_kernel
  @non_kernel
end

#runnableObject (readonly)

number of runnable processes



4
5
6
# File 'lib/vmstator/memory.rb', line 4

def runnable
  @runnable
end

#stolenObject (readonly)

time stolen from a virtual machine



20
21
22
# File 'lib/vmstator/memory.rb', line 20

def stolen
  @stolen
end

#swapped_inObject (readonly)

amount of memory swapped in from disk (/s)



10
11
12
# File 'lib/vmstator/memory.rb', line 10

def swapped_in
  @swapped_in
end

#swapped_toObject (readonly)

amount memory swapped to disk (/s)



11
12
13
# File 'lib/vmstator/memory.rb', line 11

def swapped_to
  @swapped_to
end

#uninterObject (readonly)

number of processes in uninterruptible sleep



5
6
7
# File 'lib/vmstator/memory.rb', line 5

def uninter
  @uninter
end

#usedObject (readonly)

amount of virtual memory used



6
7
8
# File 'lib/vmstator/memory.rb', line 6

def used
  @used
end

#waitingObject (readonly)

time spent waiting for IO



19
20
21
# File 'lib/vmstator/memory.rb', line 19

def waiting
  @waiting
end

Instance Method Details

#update(data) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vmstator/memory.rb', line 22

def update(data)
  if data
    @runnable     = data[:r]
    @uninter      = data[:b]
    @swapped_in   = data[:si] 
    @swapped_to   = data[:so] 
    @blocks_recv  = data[:bi] 
    @blocks_sent  = data[:bo] 
    @interrupts   = data[:in] 
    @cntxt_swtchs = data[:cs] 
    @non_kernel   = data[:us] 
    @kernel       = data[:sy] 
    @idle_time    = data[:id] 
    @waiting      = data[:wa] 
    @stolen       = data[:st] 
    @used         = data[:swpd] 
    @free         = data[:free] 
    if self.is_a? AverageMemory
      @cache  = data[:cache]
      @buffer = data[:buff]
    else
      @cache  = false    
      @buffer = false    
    end
  else
    return false
  end
  true
end