Class: Bullshit::RangeCase

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

Overview

A range case is a benchmark case, where each iteration depends on a different argument, which might cause a non-constant running time. The evaluation of the case doesn’t check for constancy and steady-state properties.

Class Attribute Summary collapse

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 Attribute Details

.argsObject

Returns the value of attribute args.



1121
1122
1123
# File 'lib/bullshit.rb', line 1121

def args
  @args
end

Class Method Details

.messageObject



1114
1115
1116
1117
# File 'lib/bullshit.rb', line 1114

def message
  "Running '#{self}' for range #{range.inspect}"\
    " (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.



1131
1132
1133
1134
1135
1136
1137
# File 'lib/bullshit.rb', line 1131

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

#runObject

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



1141
1142
1143
1144
1145
1146
# File 'lib/bullshit.rb', line 1141

def run(*)
  self.class.range or
    raise BullshitException,
      'range has to be set to an enumerable of arguments'
  super
end