class BenchmarkInfo < ActiveRecord::Base
has_many :benchmark_results, dependent: :destroy, inverse_of: :benchmark_info
validates_presence_of :name, :benchmark_class, :benchmark_selector
def self.from_json(data)
bench_info = BenchmarkInfo.find_by(name: data["name"])
unless bench_info
bench_info = BenchmarkInfo.create!(
name: data["name"],
benchmark_class: data["class"],
benchmark_selector: data["selector"],
description: data["description"]
)
end
bench_info
end
def latest_result_for_configuration(configuration)
benchmark_results.
for_configuration_id(configuration.id).
with_batch_and_duration_preloaded.
newest_first.
first
end
end
# == Schema Information
#
# Table name: benchmark_infos
#
# id :integer not null, primary key
# benchmark_class :string(255)
# benchmark_selector :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# name :string(255)
#