Class: Eye::Checker::Runtime

Inherits:
Measure show all
Defined in:
lib/eye/checker/runtime.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

Instance Method Summary collapse

Methods inherited from Measure

#good?, #measure_str

Methods inherited from Eye::Checker

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

Methods included from Dsl::Validation

included

Constructor Details

This class inherits a constructor from Eye::Checker

Instance Method Details

#get_valueObject

check :runtime, :every => 1.minute, :below => 120.minutes


5
6
7
8
9
10
11
12
# File 'lib/eye/checker/runtime.rb', line 5

def get_value
  st = Eye::SystemResources.start_time(@pid)
  if st
    Time.now.to_i - st.to_i
  else
    0
  end
end

#human_value(value) ⇒ Object


14
15
16
# File 'lib/eye/checker/runtime.rb', line 14

def human_value(value)
  "#{value / 60}m"
end