i'm looking for ideas of measuring network latency with ruby.  i can't
reliably use net::ping because rdp (remote desktop protocol) traffic
is being prioritized.  i thought i could use Net::PingTCP and get the
duration but users in a remote office are complaining of network
latency when i'm just not seeing it from the code below (even when
using a high count).

here is the the code that i'm working with.  any help or suggestions
would be much appreciated.


$endpoints = {"Office Name" => 'some.ip.address.here'}

def self.latency_summary(ping_count=50)
  $endpoints.sort.each do |k,v|
    sum = 0
    results = Array.new
    ping_count.times {
      p = Net::PingTCP.new(v, 3389)
      p.ping
      results << p.duration
    }

    results.each do |num|
      sum += num
    end

    puts "Avg/Max/Min response time to #{k} for #{ping_count.to_s} TCP
pings: #{(sum/results.length)}.sec / #{results.max}sec / #{results.min}
sec"
  end
end