Class: Eye::Checker::Memory

Inherits:
Eye::Checker show all
Defined in:
lib/eye/checker/memory.rb

Constant Summary

Constants inherited from Eye::Checker

TYPES

Instance Attribute Summary

Attributes inherited from Eye::Checker

#check_count, #options, #pid, #process, #type, #value, #values

Attributes included from Dsl::Validation

#defaults, #should_bes, #validates, #variants

Instance Method Summary collapse

Methods inherited from Eye::Checker

#check, create, #defer, get_class, #get_value_safe, #initialize, #inspect, #last_human_values, #logger_sub_tag, #logger_tag, #max_tries, #min_tries, name_and_class, #previous_value, register, #run_in_process_context, validate!

Methods included from Dsl::Validation

#inherited, #param, #validate

Constructor Details

This class inherits a constructor from Eye::Checker

Instance Method Details

#check_nameObject



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

def check_name
  @check_name ||= "memory(#{human_value(below)})"
end

#get_valueObject



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

def get_value
  Eye::SystemResources.memory(@pid).to_i * 1024
end

#good?(value) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/eye/checker/memory.rb', line 19

def good?(value)
  if below
    value < below
  else
    true
  end
end

#human_value(value) ⇒ Object



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

def human_value(value)
  "#{value.to_i / 1024 / 1024}Mb"
end