Class: TcpsnitchAnalyzer::TimeSerieStat
- Inherits:
-
Object
- Object
- TcpsnitchAnalyzer::TimeSerieStat
- Defined in:
- lib/tcpsnitch_analyzer/time_serie_stat.rb
Constant Summary collapse
- @@x =
[]
- @@y =
[]
Class Method Summary collapse
Class Method Details
.add_point(timestamp, y) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/tcpsnitch_analyzer/time_serie_stat.rb', line 6 def self.add_point(, y) usec = [:sec] * 1000000 + [:usec] @@min ||= usec @@x.push(usec-@@min) @@y.push(y) end |
.print(options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tcpsnitch_analyzer/time_serie_stat.rb', line 13 def self.print() puts "Time serie plot" Gnuplot.open do |gp| Gnuplot::Plot.new(gp) do |plot| plot.title "Time serie: #{.node_path}(t)" plot.xlabel "Micro seconds" plot.ylabel .node_path.split('.').last.capitalize plot.data << Gnuplot::DataSet.new([@@x,@@y]) do |ds| ds.with = "lines" ds.linewidth = 4 ds.notitle end end end # Gnuplot.open end |