Class: Spec::Performance::Example::PerformanceExecutionBuilder
- Inherits:
-
Object
- Object
- Spec::Performance::Example::PerformanceExecutionBuilder
- Defined in:
- lib/spec/performance/example/performance_execution_builder.rb
Defined Under Namespace
Modules: PerformanceHelpers
Constant Summary collapse
- EXAMPLE_RUN_TIME_LABEL =
"Performance Example Run Time"
- ITERATION_RUN_TIME_LABEL =
"Performance Iteration Run Time"
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options, &implementation) ⇒ PerformanceExecutionBuilder
constructor
A new instance of PerformanceExecutionBuilder.
- #performance_proc ⇒ Object
Constructor Details
#initialize(options, &implementation) ⇒ PerformanceExecutionBuilder
Returns a new instance of PerformanceExecutionBuilder.
11 12 13 14 |
# File 'lib/spec/performance/example/performance_execution_builder.rb', line 11 def initialize(, &implementation) @options = @impl = implementation end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/spec/performance/example/performance_execution_builder.rb', line 6 def @options end |
Instance Method Details
#performance_proc ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/spec/performance/example/performance_execution_builder.rb', line 16 def performance_proc iterations_per_slice = [:iterations] / [:concurrency] # NOTE: Block execution only works if this is a local variable. implementation = @impl Proc.new do extend(PerformanceHelpers) example_run_time, maximum_iteration_time = _run_performance_loop(iterations_per_slice, &implementation) _assert_iterations_per_second(example_run_time, iterations_per_slice, [:iterations_per_second]) if [:iterations_per_second] _assert_maximum_iteration_time(maximum_iteration_time, [:maximum_iteration_time]) if [:maximum_iteration_time] end end |