module ABProf

Protocol:

Controller sends "ITERS [integer]\n"
Controller sends "QUIT\n" when done
Test process responds with "NOT OK\n" or crashes for bad results
Test process responds with "VALUE 27.23432" to explicitly return a single value
Test process responds with "VALUES [1.4, 2.714, 39.4, -71.4]" to explicitly return many values
  QUIT requires no response.

Constants

PROPERTIES

These are primarily for DSL use.

SUMMARY_METHODS
SUMMARY_TYPES

Public Class Methods

compare(opts = {}, &block) click to toggle source
# File lib/abprof/benchmark_dsl.rb, line 158
def self.compare(opts = {}, &block)
  c = ABProf::BenchmarkInstance.new
  c.instance_eval &block

  raise "A DSL file must declare exactly two reports!" unless c.reports.size == 2

  unless opts[:no_at_exit]
    at_exit do
      puts "Exit handler" if opts[:print_output]
      c.run_sampling opts
    end
  end

  c
end
summarize(method, samples) click to toggle source
# File lib/abprof.rb, line 118
def self.summarize(method, samples)
  raise "Unknown summary method #{method.inspect}!" unless SUMMARY_METHODS.include?(method.to_s)
  method_proc = SUMMARY_TYPES[method.to_s]
  method_proc.call(samples)
end