Benchmarks: provide reports to simplify the code for statistical analysis.
parent
f888353ffb
commit
1e6814f4db
|
@ -29,6 +29,18 @@ class Context
|
||||||
class_property incr = 1_000
|
class_property incr = 1_000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# To simplify the creation of graphs, it's better to have fake data for
|
||||||
|
# partitions and tags that won't be actually covered.
|
||||||
|
# 0 means the absence of data.
|
||||||
|
def fake_report(name)
|
||||||
|
durations = Array(Int32).new Context.nb_run, 0
|
||||||
|
File.open("#{Context.report_dir}/#{name}.raw", "w") do |file|
|
||||||
|
durations.each do |d|
|
||||||
|
file.puts d
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "#{name}: no report"
|
||||||
|
end
|
||||||
def report(storage, name, &block)
|
def report(storage, name, &block)
|
||||||
durations = run_n_times Context.nb_run, &block
|
durations = run_n_times Context.nb_run, &block
|
||||||
File.open("#{Context.report_dir}/#{name}.raw", "w") do |file|
|
File.open("#{Context.report_dir}/#{name}.raw", "w") do |file|
|
||||||
|
@ -98,11 +110,16 @@ def batch()
|
||||||
report(storage, "#{name}_#{current_db_size}_index") do
|
report(storage, "#{name}_#{current_db_size}_index") do
|
||||||
corvet = search_name.get name_to_search
|
corvet = search_name.get name_to_search
|
||||||
end
|
end
|
||||||
report(storage, "#{name}_#{current_db_size}_partitions") do
|
if current_db_size <= Context.max_indexes
|
||||||
corvet = search_color.get? color_to_search
|
report(storage, "#{name}_#{current_db_size}_partitions") do
|
||||||
end
|
corvet = search_color.get? color_to_search
|
||||||
report(storage, "#{name}_#{current_db_size}_tags") do
|
end
|
||||||
corvet = search_keywords.get? keyword_to_search
|
report(storage, "#{name}_#{current_db_size}_tags") do
|
||||||
|
corvet = search_keywords.get? keyword_to_search
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fake_report("#{name}_#{current_db_size}_partitions")
|
||||||
|
fake_report("#{name}_#{current_db_size}_tags")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue