Calculate average Round Trip Time?

user2241637 picture user2241637 · Apr 3, 2013 · Viewed 15.3k times · Source

I have used the traceroute command and pinged my Amazon INstance. This is the result I got back:

traceroute to 10.250.19.146 (10.250.19.146), 30 hops max, 60 byte packets

1  ip-10-8-145-1.us-west-2.compute.internal (10.8.145.1)  0.996 ms  1.234 ms  3.698 ms
2  100.70.166.213 (100.70.166.213)  0.855 ms  1.179 ms 100.70.166.117 (100.70.166.117)  0.860 ms
3  100.70.175.66 (100.70.175.66)  0.925 ms 100.70.175.174 (100.70.175.174)  0.771 ms 100.70.175.238 (100.70.175.238)  0.811 ms
4  100.70.173.157 (100.70.173.157)  0.811 ms 100.70.172.193 (100.70.172.193)  0.866 ms 100.70.173.69 (100.70.173.69)  0.849 ms
5  100.70.164.46 (100.70.164.46)  4.411 ms 100.70.163.206 (100.70.163.206)  4.655 ms  4.915 ms
6  ip-10-250-19-146.us-west-2.compute.internal (10.250.19.146)  0.563 ms  0.267 ms  0.267 ms

Using the data, how can I calculate the average RTT time?

Answer

2to1mux picture 2to1mux · Apr 4, 2013

You shouldn't need to use traceroute for average RTT to a specific destination. You can just use ping for that. If that is what you are trying to do, then just average the 'time' field in the output from the ping command over several packets.

If you are actually trying to get the average RTT to each hop along the path to a destination, then you can just average the three times on each line displayed (traceroute sends three packets by default and gives you the RTT for each). That will give you the average RTT for each hop (small sample obviously, you would want to adjust traceroute to send more packets to each hop for more complete average).

EDIT: If for some reason, you need to use traceroute and are only interested in the final destination, you can just average the times displayed on the last line of the output. That's the average RTT to final destination.