Good Evening, or whatever time it is there. :)
First, a Thank You for ntop, I've found it useful in diagnosing
network problems and for keeping up on what is happening on the
network.
Two small nits have been bothering me, so I took a few minutes to
patch them:
o You use "Kb" when you man 1024 bytes. Just a typeo I'm sure.
o When using the throughput display (The 'p' option) the Rcvd and
Sent columns get too big for values like "284.4 Kbps". (They will
also overflow when you break 100.0 Mbps, but I haven't seen that
yet. :))
To solve the second one, I change the display to "284 Kbps" when the
throughput exceeds 100 Kbps. I didn't think that in the cases that the
throughput exceeded 100 Kbps that the tenths digit was too useful.
For your enjoyment, here is the patch:
--- report.c.orig Tue Sep 25 21:29:15 2001
+++ report.c Tue Sep 25 21:47:27 2001
@@ -354,7 +354,7 @@
if(numBytes < 1024)
sprintf(outStr[bufIdx], "%lu", (unsigned long)numBytes);
else if (numBytes < 1048576)
- sprintf(outStr[bufIdx], "%.1f%sKb",
+ sprintf(outStr[bufIdx], "%.1f%sKB",
((float)(numBytes)/1024), separator);
else {
float tmpMBytes = ((float)numBytes)/1048576;
@@ -427,17 +427,15 @@
if (numBits < 100)
numBits = 0; /* Avoid very small decimal values */
- if (numBits < 1048576) {
- if(webMode)
- sprintf(outStr[bufIdx], "%.1f Kbps", ((float)(numBits)/1024));
- else
- sprintf(outStr[bufIdx], "%.1f Kbps", ((float)(numBits)/1024));
- } else {
- if(webMode)
- sprintf(outStr[bufIdx], "%.1f Mbps", ((float)(numBits)/1048576));
- else
- sprintf(outStr[bufIdx], "%.1f Mbps", ((float)(numBits)/1048576));
+ if(webMode) {
+ if (numBits < 1048576) sprintf(outStr[bufIdx], "%.1f Kbps",
+((float)(numBits)/1024));
+ else sprintf(outStr[bufIdx], "%.1f Mbps", ((float)(numBits)/1048576));
}
+
+ if (numBits < 102400) sprintf(outStr[bufIdx], "%.1f Kbps",
+((float)(numBits)/1024));
+ else if (numBits < 1048576) sprintf(outStr[bufIdx], "%.0f Kbps",
+((float)(numBits)/1024));
+ else if (numBits < 104857600) sprintf(outStr[bufIdx], "%.1f Mbps",
+((float)(numBits)/1048576));
+ else sprintf(outStr[bufIdx], "%.0f Mbps",
+((float)(numBits)/1048576));
return(outStr[bufIdx]);
}
_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listmanager.unipi.it/mailman/listinfo/ntop