-
-
Save dmalikov/5112502 to your computer and use it in GitHub Desktop.
useless ruby_gnuplot http://touhou.ru/upload/2ac740fbe9b92f4dd3e7799619abd79f.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'gnuplot' | |
require 'ostruct' | |
def read file | |
times = [] | |
File.open(file).each do |line| | |
_,a,_ = line.split(' ') | |
times << Float(a)/1000000 | |
end | |
return [(1..times.size).to_a, times] | |
end | |
tests = [ | |
{ :filename => "assets_before_deleting_all.log", | |
:desc => "14:40 - 15:25 without deleting" }, | |
{ :filename => "assets_after_first_deleting_test_all.log", | |
:desc => "15:30 - 15:50, deleting 150/30 assets/seconds" }, | |
{ :filename => "assets_after_second_deleting_test_all.log", | |
:desc => "15:50 - 16:30, deleting 500/30 assets/seconds" }, | |
{ :filename => "assets_after_third_deleting_test_all.log", | |
:desc => "16:30 - 17:15, deleting 500/30 assets/seconds" } | |
] | |
Gnuplot.open do |gp| | |
Gnuplot::Plot.new(gp) do |plot| | |
plot.xlabel "Asset number" | |
plot.ylabel "Time from first packet to flush, s" | |
plot.terminal "png size 1000,800" | |
plot.output File.expand_path "../results.png", __FILE__ | |
plot.data = tests.map do |t| | |
Gnuplot::DataSet.new(read t[:filename]) do |ds| | |
ds.title = t[:desc] | |
ds.with = "lines" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment