Class: Aio::Module::Cmd::Maipu::ShowMemory

Inherits:
Aio::Module::Cmd::Maipu show all
Includes:
Aio::Module
Defined in:
lib/modules/cmd/maipu/show_memory.rb

Instance Attribute Summary

Attributes inherited from Aio::Module::Cmd

#cmd_info, #context, #device_info, #ext_info, #useful, #warning_klass

Instance Method Summary collapse

Methods inherited from Aio::Module::Cmd

#author, #benchmark, #clear_useful, #cmd_full, #cmd_short, #description, #division, #key_stand, #license, #platform, #ranking, #set_defaults, #type

Methods included from Ui::Verbose

#clear_line, #print_error, #print_good, #progress_bar

Constructor Details

#initializeShowMemory

Returns a new instance of ShowMemory.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/modules/cmd/maipu/show_memory.rb', line 8

def initialize
  super({
    :cmd_full			=> "show memory",
    :cmd_short		=> "sh mem", 
    :author				=> "Elin",
    :description	=> "This is Maipu Command# show memory",
    :ranking			=> Ranking_1,
    :platform			=> "all",
    :benchmark		=> {
      :used_percent		=> ["<", 70.0],		
    }
  })
end

Instance Method Details

#parseObject



22
23
24
25
26
27
28
29
# File 'lib/modules/cmd/maipu/show_memory.rb', line 22

def parse
  cont = self.context.dup
  useful[:memory] = {}
  cont.readline_match_block(/STATISTICS/) {|b|b}
  cont.readline_match_block(/(?<used_percent>\d+[\.]\d+)%/) do |block|
    block.warning_serious(useful[:memory], :used_percent, self)
  end
end