Class: Vmstator::EventCounterStatistics

Inherits:
Object
  • Object
show all
Defined in:
lib/vmstator/linux/event_counter_statistics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = false) ⇒ EventCounterStatistics

Returns a new instance of EventCounterStatistics.



31
32
33
34
35
36
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 31

def initialize(data=false)
  if data
    update(data)
  end
  true
end

Instance Attribute Details

#active_memoryObject (readonly)

Returns the value of attribute active_memory.



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

def active_memory
  @active_memory
end

#boot_timeObject (readonly)

Returns the value of attribute boot_time.



28
29
30
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 28

def boot_time
  @boot_time
end

#buffer_memoryObject (readonly)

Returns the value of attribute buffer_memory.



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

def buffer_memory
  @buffer_memory
end

#cpu_context_switchesObject (readonly)

Returns the value of attribute cpu_context_switches.



27
28
29
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 27

def cpu_context_switches
  @cpu_context_switches
end

#forksObject (readonly)

Returns the value of attribute forks.



29
30
31
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 29

def forks
  @forks
end

#free_memoryObject (readonly)

Returns the value of attribute free_memory.



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

def free_memory
  @free_memory
end

#free_swapObject (readonly)

Returns the value of attribute free_swap.



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

def free_swap
  @free_swap
end

#idle_cpu_ticksObject (readonly)

Returns the value of attribute idle_cpu_ticks.



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

def idle_cpu_ticks
  @idle_cpu_ticks
end

#inactive_memoryObject (readonly)

Returns the value of attribute inactive_memory.



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

def inactive_memory
  @inactive_memory
end

#interruptsObject (readonly)

Returns the value of attribute interrupts.



26
27
28
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 26

def interrupts
  @interrupts
end

#io_wait_cpu_ticksObject (readonly)

Returns the value of attribute io_wait_cpu_ticks.



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

def io_wait_cpu_ticks
  @io_wait_cpu_ticks
end

#irq_cpu_ticksObject (readonly)

Returns the value of attribute irq_cpu_ticks.



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

def irq_cpu_ticks
  @irq_cpu_ticks
end

#nice_user_cpu_ticksObject (readonly)

Returns the value of attribute nice_user_cpu_ticks.



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

def nice_user_cpu_ticks
  @nice_user_cpu_ticks
end

#non_nice_user_cpu_ticksObject (readonly)

Returns the value of attribute non_nice_user_cpu_ticks.



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

def non_nice_user_cpu_ticks
  @non_nice_user_cpu_ticks
end

#pages_paged_inObject (readonly)

Returns the value of attribute pages_paged_in.



22
23
24
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 22

def pages_paged_in
  @pages_paged_in
end

#pages_paged_outObject (readonly)

Returns the value of attribute pages_paged_out.



23
24
25
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 23

def pages_paged_out
  @pages_paged_out
end

#pages_swapped_inObject (readonly)

Returns the value of attribute pages_swapped_in.



24
25
26
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 24

def pages_swapped_in
  @pages_swapped_in
end

#pages_swapped_outObject (readonly)

Returns the value of attribute pages_swapped_out.



25
26
27
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 25

def pages_swapped_out
  @pages_swapped_out
end

#softirq_cpu_ticksObject (readonly)

Returns the value of attribute softirq_cpu_ticks.



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

def softirq_cpu_ticks
  @softirq_cpu_ticks
end

#stolen_cpu_ticksObject (readonly)

Returns the value of attribute stolen_cpu_ticks.



21
22
23
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 21

def stolen_cpu_ticks
  @stolen_cpu_ticks
end

#swap_cacheObject (readonly)

Returns the value of attribute swap_cache.



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

def swap_cache
  @swap_cache
end

#system_cpu_ticksObject (readonly)

Returns the value of attribute system_cpu_ticks.



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

def system_cpu_ticks
  @system_cpu_ticks
end

#total_memoryObject (readonly)

Returns the value of attribute total_memory.



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

def total_memory
  @total_memory
end

#total_swapObject (readonly)

Returns the value of attribute total_swap.



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

def total_swap
  @total_swap
end

#used_memoryObject (readonly)

Returns the value of attribute used_memory.



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

def used_memory
  @used_memory
end

#used_swapObject (readonly)

Returns the value of attribute used_swap.



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

def used_swap
  @used_swap
end

Instance Method Details

#update(data) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/vmstator/linux/event_counter_statistics.rb', line 38

def update(data)
  if data
    @total_memory            = data[:total_memory]
    @used_memory             = data[:used_memory]
    @active_memory           = data[:active_memory]
    @inactive_memory         = data[:inactive_memory]
    @free_memory             = data[:free_memory]
    @buffer_memory           = data[:buffer_memory]
    @swap_cache              = data[:swap_cache]
    @total_swap              = data[:total_swap]
    @used_swap               = data[:used_swap]
    @free_swap               = data[:free_swap]
    @non_nice_user_cpu_ticks = data[:non_nice_user_cpu_ticks]
    @nice_user_cpu_ticks     = data[:nice_user_cpu_ticks]
    @system_cpu_ticks        = data[:system_cpu_ticks]
    @idle_cpu_ticks          = data[:idle_cpu_ticks]
    @io_wait_cpu_ticks       = data[:io_wait_cpu_ticks]
    @irq_cpu_ticks           = data[:irq_cpu_ticks]
    @softirq_cpu_ticks       = data[:softirq_cpu_ticks]
    @stolen_cpu_ticks        = data[:stolen_cpu_ticks]
    @pages_paged_in          = data[:pages_paged_in]
    @pages_paged_out         = data[:pages_paged_out]
    @pages_swapped_in        = data[:pages_swapped_in]
    @pages_swapped_out       = data[:pages_swapped_out]
    @interrupts              = data[:interrupts]
    @cpu_context_switches    = data[:cpu_context_switches]
    @boot_time               = data[:boot_time]
    @forks                   = data[:forks]
  else
    return false
  end
  true
end