From 3b7d58104eadbf9724b2d09d27d7ecba6a5c8498 Mon Sep 17 00:00:00 2001 From: chris <> Date: Wed, 27 Mar 2002 00:04:43 +0000 Subject: [PATCH] "" --- iftop.8 | 7 ++++--- resolver.c | 3 --- ui.c | 9 +++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/iftop.8 b/iftop.8 index b3bbfa4..c3309e2 100644 --- a/iftop.8 +++ b/iftop.8 @@ -26,10 +26,11 @@ if none is specified, and displays a table of current bandwidth usage by pairs of hosts. When run, \fBiftop\fP displays, for each pair of hosts, the rate at which data -is sent and received averaged over 3, 15 and 60 second intervals. The direction +is sent and received averaged over 1, 5 and 20 second intervals. The direction of data flow is indicated by arrows, <= and =>. In addition, a simple bar graph -shows the 15-second average. The pairs of hosts which consume the most bandwidth -are displayed at the top of the screen. +shows the 5-second average. The pairs of hosts which consume the most bandwidth +are displayed at the top of the screen, and totals for all hosts are shown at +the bottom of the screen. By default, \fBiftop\fP will look up the hostnames associated with addresses it finds in packets. This can cause substantial traffic of itself, and may result diff --git a/resolver.c b/resolver.c index c095b56..520c4ac 100644 --- a/resolver.c +++ b/resolver.c @@ -55,8 +55,6 @@ void resolver_worker(void* ptr) { pthread_mutex_unlock(&resolver_queue_mutex); - - hstbuflen = 1024; /* Allocate buffer, remember to free it to avoid memory leakage. */ tmphstbuf = xmalloc (hstbuflen); @@ -69,7 +67,6 @@ void resolver_worker(void* ptr) { tmphstbuf = realloc (tmphstbuf, hstbuflen); } - /* * Store the result in ns_hash */ diff --git a/ui.c b/ui.c index 7866457..6d2b85d 100644 --- a/ui.c +++ b/ui.c @@ -18,9 +18,10 @@ #define HOSTNAME_LENGTH 256 -#define HISTORY_DIVISIONS 3 +#define HISTORY_DIVISIONS 3 +#define BARGRAPH_INTERVAL 1 /* which division used for bars. */ -/* 3, 15 and 60 seconds */ +/* 1, 15 and 60 seconds */ int history_divs[HISTORY_DIVISIONS] = {1, 5, 20}; @@ -240,12 +241,12 @@ void ui_print() { /* Do some sort of primitive bar graph thing. */ mvchgat(y, 0, -1, A_NORMAL, 0, NULL); - L = get_bar_length(8 * screen_line->sent[0] / history_divs[0]); + L = get_bar_length(8 * screen_line->sent[BARGRAPH_INTERVAL] / history_divs[BARGRAPH_INTERVAL]); if (L > 0) mvchgat(y, 0, L, A_REVERSE, 0, NULL); mvchgat(y+1, 0, -1, A_NORMAL, 0, NULL); - L = get_bar_length(8 * screen_line->recv[0] / history_divs[0]); + L = get_bar_length(8 * screen_line->recv[BARGRAPH_INTERVAL] / history_divs[BARGRAPH_INTERVAL]); if (L > 0) mvchgat(y+1, 0, L, A_REVERSE, 0, NULL); }