class ABProf::ABBareProcess
Attributes
last_iters[R]
last_run[R]
Public Class Methods
new(command_line, opts = {})
click to toggle source
# File lib/abprof.rb, line 132 def initialize command_line, opts = {} @command = command_line @debug = opts[:debug] end
Public Instance Methods
debug(string)
click to toggle source
# File lib/abprof.rb, line 128 def debug string STDERR.puts(string) if @debug end
kill()
click to toggle source
# File lib/abprof.rb, line 141 def kill # No-op end
quit()
click to toggle source
# File lib/abprof.rb, line 137 def quit # No-op end
run_iters(n)
click to toggle source
# File lib/abprof.rb, line 145 def run_iters(n) t_start = t_end = nil debug "Controller of #{@pid}: #{n} ITERS" state = :succeeded n.times do if @command.respond_to?(:call) t_start = Time.now @command.call t_end = Time.now elsif @command.respond_to?(:to_s) t_start = Time.now system(@command.to_s) t_end = Time.now unless $?.success? STDERR.puts "Failing process #{@pid} after failed iteration(s), error code #{state.inspect}" # How to handle error with no self.kill? raise "Failure from command #{@command.inspect}, dying!" end else raise "Don't know how to execute bare object: #{@command.inspect}!" end end @last_run = [(t_end - t_start).to_f] @last_iters = n @last_run end