This commit is contained in:
chris
2002-03-27 19:04:19 +00:00
parent 7422fcda9a
commit afa7248c03
2 changed files with 18 additions and 7 deletions

View File

@@ -221,15 +221,16 @@ void packet_loop(void* ptr) {
void usage(FILE *fp) {
fprintf(fp,
"iftop: display bandwidth usage on an interface by host\n"
"Options:\n"
"\n"
"Synopsis: iftop -h | [-d] [-p] [-i interface] [-f filter code]\n"
"\n"
" -h display this message\n"
" -d don't do hostname lookups\n"
" -p run in promiscuous mode (show traffic between other\n"
" hosts on the same network segment)\n"
" -i interface listen on named interface (default: eth0)\n"
" -f filter code use filter code to select packets to count\n"
" (default: none, but only IP packets are counted)\n"
" -p run in promiscuous mode (show traffic between other\n"
" hosts on the same network segment)\n"
" -h display this message\n"
"\n"
"iftop, $Id$\n"
);

16
ui.c
View File

@@ -102,12 +102,11 @@ int history_length(const int d) {
}
void draw_line_totals(int y, host_pair_line* line) {
int j;
int j, t, L;
char buf[10];
int x = (COLS - 8 * HISTORY_DIVISIONS);
for(j = 0; j < HISTORY_DIVISIONS; j++) {
int t;
t = history_length(j);
readable_size(8 * line->sent[j] / t, buf, 10, 1024);
mvaddstr(y, x, buf);
@@ -117,6 +116,16 @@ void draw_line_totals(int y, host_pair_line* line) {
x += 8;
}
t = history_length(BARGRAPH_INTERVAL);
mvchgat(y, 0, -1, A_NORMAL, 0, NULL);
L = get_bar_length(8 * line->sent[BARGRAPH_INTERVAL] / t);
if (L > 0)
mvchgat(y, 0, L + 1, A_REVERSE, 0, NULL);
mvchgat(y+1, 0, -1, A_NORMAL, 0, NULL);
L = get_bar_length(8 * line->recv[BARGRAPH_INTERVAL] / t);
if (L > 0)
mvchgat(y+1, 0, L + 1, A_REVERSE, 0, NULL);
}
void draw_totals(host_pair_line* totals) {
@@ -260,7 +269,6 @@ void ui_print() {
free(screen_line);
}
draw_totals(&totals);
y = LINES - 2;
mvaddstr(y, 0, "sent peak: ");
@@ -274,6 +282,8 @@ void ui_print() {
mvaddstr(y, COLS - 8 * HISTORY_DIVISIONS - 10, "totals:");
draw_totals(&totals);
refresh();
sorted_list_destroy(&screen_list);