Class: Perfgate::Workloads::Workload

Inherits:
Object
  • Object
show all
Defined in:
lib/perfgate/workloads/workload.rb

Overview

A deterministic executable path measured by Baseline (spec section 7). Normally backed by one RSpec example, but the callable is kept generic so the execution engine can be exercised without RSpec.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, samples:, warmup:, metrics: [:duration], &block) ⇒ Workload

Returns a new instance of Workload.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
# File 'lib/perfgate/workloads/workload.rb', line 11

def initialize(id:, samples:, warmup:, metrics: [:duration], &block)
  raise ArgumentError, "workload #{id.inspect} requires a block to execute" unless block

  @id = id
  @samples = samples
  @warmup = warmup
  @metrics = metrics
  @block = block
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/perfgate/workloads/workload.rb', line 9

def id
  @id
end

#metricsObject (readonly)

Returns the value of attribute metrics.



9
10
11
# File 'lib/perfgate/workloads/workload.rb', line 9

def metrics
  @metrics
end

#samplesObject (readonly)

Returns the value of attribute samples.



9
10
11
# File 'lib/perfgate/workloads/workload.rb', line 9

def samples
  @samples
end

#warmupObject (readonly)

Returns the value of attribute warmup.



9
10
11
# File 'lib/perfgate/workloads/workload.rb', line 9

def warmup
  @warmup
end

Instance Method Details

#callObject



21
22
23
# File 'lib/perfgate/workloads/workload.rb', line 21

def call
  @block.call
end