21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/tcpsnitch_analyzer/descriptive_stat.rb', line 21
def self.print(options)
puts "Descriptive statistics:"
@@data.descriptive_statistics.each do |key, value|
puts "#{key}".ljust(20) + "#{value}"
end
return unless @@data.range > 0
x = @@data.sort
n = x.size
y = x.map do |el|
((x.rindex { |v| v <= el } || -1.0) + 1.0) / n * 100.0
end
Gnuplot.open do |gp|
Gnuplot::Plot.new(gp) do |plot|
plot.xrange "[#{@@data.min}:#{@@data.max}]; set logscale x"
plot.title "CDF for #{options.node_path} (#{options.event_filter} events)"
plot.xlabel "Value"
plot.ylabel "Normal CDF"
plot.data << Gnuplot::DataSet.new([x,y]) do |ds|
ds.with = "lines"
ds.linewidth = 4
ds.title = options.node_path.split('.').last
end
end
end end
|