Class: NoSE::Serialize::WorkloadRepresenter

Inherits:
Representable::Decorator
  • Object
show all
Includes:
Representable::Hash, Representable::JSON, Representable::Uncached, Representable::YAML
Defined in:
lib/nose/serialize.rb

Overview

Represent statements in a workload

Instance Method Summary collapse

Methods included from Representable::Uncached

#representable_map

Instance Method Details

#weightsHash

Produce weights of each statement in the workload for each mix

Returns:

  • (Hash)


445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/nose/serialize.rb', line 445

def weights
  weights = {}
  workload_weights = represented \
                     .instance_variable_get(:@statement_weights)
  workload_weights.each do |mix, mix_weights|
    weights[mix] = {}
    mix_weights.each do |statement, weight|
      statement = StatementRepresenter.represent(statement).to_hash
      weights[mix][statement] = weight
    end
  end

  weights
end