Date: Mon, 3 Jul 1995 10:04:11 +0800 (WST) From: Peter Wemm <peter@haywire.DIALix.COM> To: current@freebsd.org Subject: comments on my favourite hack to traceroute? Message-ID: <Pine.SV4.3.91.950703094507.20149O@haywire.DIALix.COM>
next in thread | raw e-mail | index | archive | help
This is my favourite hack to traceroute to rationalize the number of
digits printed in the rtt stats..
The standard one prints three numbers after the decimal point, and when
you're up in the thousands of milliseconds (try going from australia to
the depths of europe some time.. :-), then the numbers are a bit of
overkill. It makes the display look very messy.
I made a change to cause traceroute to only show a limited number of
significant digits..
ie:
before after
0.123 ms 0.123 ms
6.233 ms 6.233 ms
25.231 ms 25.23 ms
121.345 ms 121 ms (I chose not to put in any decimals if > 100.0)
2323.543 ms 2323 ms
This stops screen wrap arounds for while crossing most of the MCI and
Sprint backbones, and what's left of the ANS backbone.
Is this kind of thing useful to people?
This is what it looks like over a local ethernet:
traceroute to haywire.DIALix.COM (192.203.228.65), 30 hops max, 40 byte packets
1 haywire (192.203.228.65) 3.053 ms 2.393 ms 2.227 ms
and this is what it looks like after crossing a few modems and ISDN links:
traceroute to freefall.cdrom.com (192.216.222.4), 30 hops max, 40 byte packets
1 gecko.DIALix.oz.au (192.203.228.3) 155 ms 147 ms 125 ms
2 frontdoor (192.203.228.4) 132 ms 157 ms 127 ms
3 doormat1 (192.203.228.241) 161 ms 190 ms 162 ms
4 national.gw.au (139.130.85.1) 228 ms 272 ms 250 ms
5 usa.gw.au (139.130.240.2) 269 ms 254 ms 217 ms
6 border4-hssi1-0.SanFrancisco.mci.net (204.70.35.5) 481 ms 420 ms 420 ms
7 core-fddi-1.SanFrancisco.mci.net (204.70.3.161) 401 ms * 447 ms
8 border1-fddi0-0.SanFrancisco.mci.net (204.70.2.162) 491 ms * 478 ms
9 barrnet.SanFrancisco.mci.net (204.70.32.6) 420 ms 433 ms *
10 * su-b.barrnet.net (192.31.48.201) 522 ms 1172 ms
11 ucbnew.barrnet.net (131.119.2.2) 507 ms 461 ms 444 ms
12 ucb2.barrnet.net (131.119.253.3) 492 ms 422 ms 495 ms
13 cdrom.barrnet.net (131.119.70.134) 545 ms 487 ms 519 ms
14 freefall.cdrom.com (192.216.222.4) 534 ms 605 ms 535 ms
Opinions?
-Peter
*** traceroute.c.dist Thu May 25 01:44:04 1995
--- traceroute.c Mon Jul 3 09:44:39 1995
***************
*** 306,312 ****
struct hostent *hp;
struct protoent *pe;
struct sockaddr_in from, *to;
! int ch, i, on, probe, seq, tos, ttl;
on = 1;
seq = tos = 0;
--- 306,313 ----
struct hostent *hp;
struct protoent *pe;
struct sockaddr_in from, *to;
! int ch, i, on, probe, seq, tos, ttl, p;
! double dt;
on = 1;
seq = tos = 0;
***************
*** 507,513 ****
--- 508,531 ----
print(packet, cc, &from);
lastaddr = from.sin_addr.s_addr;
}
+
+ #if !defined(MESSY)
+ /*
+ * This quick hack is to try and rationalize the number of significant
+ * digits in the output. If you have a hop 2000ms away, it's not a lot of
+ * use knowing +/- 1 ms, let alone +/- 0.001 ms.... -Peter
+ */
+ dt = deltaT(&t1, &t2);
+ if (dt >= 100.0)
+ p = 0;
+ else if (dt >= 10.0)
+ p = 2;
+ else
+ p = 3;
+ Printf(" %.*f ms", p, dt);
+ #else
Printf(" %.3f ms", deltaT(&t1, &t2));
+ #endif
switch(i - 1) {
case ICMP_UNREACH_PORT:
#ifndef ARCHAIC
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.91.950703094507.20149O>
