Class: Perfgate::Execution::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/perfgate/execution/runner.rb

Overview

Executes a single workload's warmup and measured samples in the current process (spec section 12.2, steps 4-9). Process isolation across workloads is layered on top by ProcessRunner. SQL count/ duration, allocations, and GC deltas are collected only inside the workload's explicit Perfgate.measure block; duration falls back to wall-clock timing of the whole workload when Perfgate.measure is never called (spec section 13.1).

A failed assertion or raised exception inside the workload is an execution error, not a performance regression (spec section 12.2): it aborts this workload's run and is reported as status: "error" rather than raising out of call.

Instance Method Summary collapse

Constructor Details

#initialize(workload) ⇒ Runner

Returns a new instance of Runner.



21
22
23
# File 'lib/perfgate/execution/runner.rb', line 21

def initialize(workload)
  @workload = workload
end

Instance Method Details

#callObject



25
26
27
28
29
30
31
32
33
# File 'lib/perfgate/execution/runner.rb', line 25

def call
  @workload.warmup.times { run_once }

  samples = Array.new(@workload.samples) { run_once }

  result("completed", samples, nil)
rescue StandardError => e
  result("error", [], "#{e.class}: #{e.message}")
end