Class: Bullshit::RepeatCase

Inherits:
Case
  • Object
show all
Extended by:
DSLKit::Constant, DSLKit::DSLAccessor
Includes:
EvaluationModule
Defined in:
lib/bullshit.rb

Overview

This is a Benchmarking Case that uses a repetition limit.

Instance Attribute Summary

Attributes inherited from Case

#clocks

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EvaluationModule

#detect_autocorrelation, #detect_outliers, #histogram, #statistics_table

Methods inherited from Case

#[], autorun_all, #bmethods, each, inherited, #initialize, #longest_name, output_filename, #post_run, #pre_run, run, run_all, run_count, #run_method, #run_once, #setup, sorted_bmethods, #teardown, #to_s, #write_files

Constructor Details

This class inherits a constructor from Bullshit::Case

Class Method Details

.messageObject


2013
2014
2015
2016
# File 'lib/bullshit.rb', line 2013

def message
  "Running '#{self}' for #{iterations} iterations/method"\
    " (compare_time=#{compare_time})"
end

Instance Method Details

#evaluation(clock) ⇒ Object

Returns the evaluation for bullshit_case with the results of the benchmarking as a String.


2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
# File 'lib/bullshit.rb', line 2023

def evaluation(clock)
  clock.repeat == 0 and
    raise BullshitException, "no measurements were gauged"
  result = ''
  result << statistics_table(clock)
  result << histogram(clock)
  result << detect_outliers(clock)
  result << detect_autocorrelation(clock) 
  result << "\n"
end

#runObject

vn heck if iterations has been set. If yes call Case#run, otherwise raise a BullshitException exception.


2036
2037
2038
2039
2040
# File 'lib/bullshit.rb', line 2036

def run(*)
  self.class.iterations or
    raise BullshitException, 'iterations have to be set'
  super
end