class Scriptroute::Tulip::QueueTrain
Attributes
train[R]
Public Class Methods
new(dst, type, ttl)
click to toggle source
# File lib/scriptroute/tulip/queuing.rb, line 8 def initialize(dst, type, ttl) #(dsts, numpackets, resolution, types, ttls, shuffle=false) #@train = Train.new([dst], 2, 0, [type], [ttl]); @train = Train.new([dst], 1, 0, [type], [ttl]); end
Public Instance Methods
isLossy?()
click to toggle source
# File lib/scriptroute/tulip/queuing.rb, line 14 def isLossy? ##losing one of the two timestamps all the time is ok. return (@train.num_losses[0] > 1); end
to_s()
click to toggle source
def to_s
return @train.to_s;
end
# File lib/scriptroute/tulip/queuing.rb, line 23 def to_s str = "queuetrain: #{@train.dsts} (#{@train.types})\n"; @train.packets[0].each_index { |i| (@train.dsts).each_index { |j| pr = @train.packets[j][i]; stime = pr.probe.time.to_f * 1000; rtt = (pr.probe and pr.response) ? (pr.response.time - pr.probe.time) * 1000 : -1; str += "#{@train.dsts[j]} %.3fms %.3f " %[rtt, stime]; if (@train.types[j] == "tstamp") then rem_time = (pr.response)? pr.response.packet.icmp_ttime : 0; str += "#{rem_time}"; end } str += "\n"; } return str; end