103 lines
2.8 KiB
Ruby
103 lines
2.8 KiB
Ruby
|
$:.push "."
|
||
|
|
||
|
require "gnuplot"
|
||
|
require "util.rb"
|
||
|
require "plot.rb"
|
||
|
require "csvx.rb"
|
||
|
|
||
|
data = File.csv("data.csv", header: true)
|
||
|
|
||
|
plot_output :aqua
|
||
|
# $plot_auto_open = true
|
||
|
|
||
|
all_strategies =
|
||
|
[
|
||
|
"Mimir-Mat",
|
||
|
"Mimir-Inline",
|
||
|
"Mimir-Sample",
|
||
|
"Mimir-Partition",
|
||
|
"MCDB-Mimir",
|
||
|
"SQLite-Det",
|
||
|
"MayBMS-PGSQL",
|
||
|
"MayBMS-SQLite",
|
||
|
]
|
||
|
|
||
|
data.map { |r| [r["Query"].split(/-/)[0], r] }
|
||
|
.reduce
|
||
|
.each do |group, records|
|
||
|
|
||
|
plot group => ["data.csv", "Rakefile"] do |plot|
|
||
|
|
||
|
strategies =
|
||
|
all_strategies
|
||
|
.where { |s| records.index { |r| r["Strategy"] == s } }
|
||
|
queries =
|
||
|
records
|
||
|
.map { |r| r["Query"] }
|
||
|
.uniq.sort
|
||
|
lookup = records.map { |r| [[r["Strategy"], r["Query"]], r["Time"]] }.to_h
|
||
|
strategies
|
||
|
|
||
|
pretty_plot(plot, border: [:all])
|
||
|
plot.key "left top opaque"
|
||
|
plot.ylabel "Time (s)"
|
||
|
max_y =
|
||
|
records.map { |r| r["Time"] }
|
||
|
.where { |r| /[\-0-9.]+/ =~ r }
|
||
|
.map { |r| r.to_f }
|
||
|
.max
|
||
|
|
||
|
case group
|
||
|
when "TPCH"
|
||
|
max_y = 300
|
||
|
plot.key "center top outside maxcols 3 maxrows 2"
|
||
|
when "PDB"
|
||
|
max_y = 45
|
||
|
plot.key "center top outside maxcols 3 maxrows 3"
|
||
|
end
|
||
|
plot.yrange "[0:#{max_y}]"
|
||
|
|
||
|
labels = []
|
||
|
|
||
|
draw_clustered_bar_plot(plot,
|
||
|
data: (queries.map.with_index { |q,qi|
|
||
|
strategies.map.with_index { |s,si|
|
||
|
time = lookup[[s,q]]
|
||
|
x_pos = bar_plot_position(si, qi, strategies.length)+1
|
||
|
font = "Helvetica-Bold,6"
|
||
|
case time
|
||
|
when nil then
|
||
|
labels.push "'?? Missing ??' at #{x_pos},6 font '#{font}' rotate by 90"
|
||
|
when "TIMEOUT" then
|
||
|
labels.push "'TIME OUT' at #{x_pos},#{max_y * 0.80} font '#{font}' rotate by 90 front"
|
||
|
max_y * 1.2
|
||
|
when "UNSUPPORTED"
|
||
|
labels.push "'UNSUPPORTED' at #{x_pos},5 font '#{font}' rotate by 90 front tc ls #{si+1}"
|
||
|
1
|
||
|
else
|
||
|
time = time.to_f
|
||
|
if time > max_y
|
||
|
labels.push "'[ #{time.to_i}s ]' at #{x_pos},#{max_y * 0.80} font 'Helvetica-Bold,8' rotate by 90 front"
|
||
|
end
|
||
|
time
|
||
|
end
|
||
|
}
|
||
|
}),
|
||
|
dataset_labels: strategies,
|
||
|
group_labels: queries,
|
||
|
bar_width: 15
|
||
|
)
|
||
|
labels.each { |l| plot.label l }
|
||
|
|
||
|
(1...queries.length).each { |qi|
|
||
|
x_pos = bar_plot_position(0, qi, strategies.length) - 18
|
||
|
plot.arrow("from #{x_pos},0 to #{x_pos},#{max_y} nohead lc rgb \"#808080\"")
|
||
|
}
|
||
|
|
||
|
|
||
|
end
|
||
|
|
||
|
task :default => group
|
||
|
|
||
|
end
|