""
This commit is contained in:
9
iftop.c
9
iftop.c
@@ -221,15 +221,16 @@ void packet_loop(void* ptr) {
|
|||||||
void usage(FILE *fp) {
|
void usage(FILE *fp) {
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"iftop: display bandwidth usage on an interface by host\n"
|
"iftop: display bandwidth usage on an interface by host\n"
|
||||||
"Options:\n"
|
|
||||||
"\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"
|
" -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"
|
" -i interface listen on named interface (default: eth0)\n"
|
||||||
" -f filter code use filter code to select packets to count\n"
|
" -f filter code use filter code to select packets to count\n"
|
||||||
" (default: none, but only IP packets are counted)\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"
|
"\n"
|
||||||
"iftop, $Id$\n"
|
"iftop, $Id$\n"
|
||||||
);
|
);
|
||||||
|
|||||||
16
ui.c
16
ui.c
@@ -102,12 +102,11 @@ int history_length(const int d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_line_totals(int y, host_pair_line* line) {
|
void draw_line_totals(int y, host_pair_line* line) {
|
||||||
int j;
|
int j, t, L;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
int x = (COLS - 8 * HISTORY_DIVISIONS);
|
int x = (COLS - 8 * HISTORY_DIVISIONS);
|
||||||
|
|
||||||
for(j = 0; j < HISTORY_DIVISIONS; j++) {
|
for(j = 0; j < HISTORY_DIVISIONS; j++) {
|
||||||
int t;
|
|
||||||
t = history_length(j);
|
t = history_length(j);
|
||||||
readable_size(8 * line->sent[j] / t, buf, 10, 1024);
|
readable_size(8 * line->sent[j] / t, buf, 10, 1024);
|
||||||
mvaddstr(y, x, buf);
|
mvaddstr(y, x, buf);
|
||||||
@@ -116,7 +115,17 @@ void draw_line_totals(int y, host_pair_line* line) {
|
|||||||
mvaddstr(y+1, x, buf);
|
mvaddstr(y+1, x, buf);
|
||||||
x += 8;
|
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) {
|
void draw_totals(host_pair_line* totals) {
|
||||||
@@ -260,7 +269,6 @@ void ui_print() {
|
|||||||
free(screen_line);
|
free(screen_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_totals(&totals);
|
|
||||||
|
|
||||||
y = LINES - 2;
|
y = LINES - 2;
|
||||||
mvaddstr(y, 0, "sent peak: ");
|
mvaddstr(y, 0, "sent peak: ");
|
||||||
@@ -274,6 +282,8 @@ void ui_print() {
|
|||||||
|
|
||||||
mvaddstr(y, COLS - 8 * HISTORY_DIVISIONS - 10, "totals:");
|
mvaddstr(y, COLS - 8 * HISTORY_DIVISIONS - 10, "totals:");
|
||||||
|
|
||||||
|
draw_totals(&totals);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
sorted_list_destroy(&screen_list);
|
sorted_list_destroy(&screen_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user