Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Paul Warren
iftop
Commits
75eaa8dd
Commit
75eaa8dd
authored
Mar 29, 2002
by
pdw
Browse files
Added overall peak and total.
parent
7a0e4a78
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
75eaa8dd
...
...
@@ -74,3 +74,5 @@ nodepend:
rm
-f
depend
# DO NOT DELETE
iftop.8
View file @
75eaa8dd
...
...
@@ -19,9 +19,9 @@ 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
1
,
5
and
2
0 second intervals. The direction
is sent and received averaged over
2
,
10
and
4
0 second intervals. The direction
of data flow is indicated by arrows, <= and =>. In addition, a simple bar graph
shows the
5
-second average. The pairs of hosts which consume the most bandwidth
shows the
10
-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.
...
...
ui.c
View file @
75eaa8dd
...
...
@@ -145,11 +145,12 @@ void ui_print() {
char
hostname
[
HOSTNAME_LENGTH
];
static
char
*
line
;
static
int
lcols
;
int
peaksent
=
0
;
int
peakrecv
=
0
;
int
peaksent
=
0
,
peakrecv
=
0
,
peaktotal
=
0
;
int
y
=
0
;
int
i
;
sorted_list_type
screen_list
;
host_pair_line
totals
;
history_type
history_totals
;
if
(
!
line
||
lcols
!=
COLS
)
{
xfree
(
line
);
...
...
@@ -174,6 +175,7 @@ void ui_print() {
draw_bar_scale
();
memset
(
&
totals
,
0
,
sizeof
totals
);
memset
(
&
history_totals
,
0
,
sizeof
history_totals
);
while
(
hash_next_item
(
history
,
&
n
)
==
HASH_STATUS_OK
)
{
history_type
*
d
=
(
history_type
*
)
n
->
rec
;
...
...
@@ -184,6 +186,7 @@ void ui_print() {
screen_line
=
xcalloc
(
1
,
sizeof
*
screen_line
);
screen_line
->
ap
=
(
addr_pair
*
)
n
->
key
;
for
(
i
=
0
;
i
<
HISTORY_LENGTH
;
i
++
)
{
int
j
;
...
...
@@ -195,7 +198,9 @@ void ui_print() {
totals
.
recv
[
j
]
+=
d
->
recv
[
ii
];
screen_line
->
sent
[
j
]
+=
d
->
sent
[
ii
];
if
(
d
->
promisc
==
1
)
{
/* Treat all promisc traffic as incoming */
totals
.
recv
[
j
]
+=
d
->
sent
[
ii
];
}
else
{
...
...
@@ -204,16 +209,30 @@ void ui_print() {
}
}
if
(
d
->
recv
[
ii
]
>
peakrecv
)
peakrecv
=
d
->
recv
[
ii
];
if
(
d
->
sent
[
ii
]
>
peaksent
)
peaksent
=
d
->
sent
[
ii
];
history_totals
.
recv
[
ii
]
+=
d
->
recv
[
ii
];
if
(
d
->
promisc
==
1
)
{
/* Treat all promisc traffic as incoming */
history_totals
.
recv
[
ii
]
+=
d
->
sent
[
ii
];
}
else
{
history_totals
.
sent
[
ii
]
+=
d
->
sent
[
ii
];
}
}
sorted_list_insert
(
&
screen_list
,
screen_line
);
}
for
(
i
=
0
;
i
<
HISTORY_LENGTH
;
i
++
)
{
if
(
history_totals
.
recv
[
i
]
>
peakrecv
)
{
peakrecv
=
history_totals
.
recv
[
i
];
}
if
(
history_totals
.
sent
[
i
]
>
peaksent
)
{
peaksent
=
history_totals
.
sent
[
i
];
}
if
(
history_totals
.
recv
[
i
]
+
history_totals
.
sent
[
i
]
>
peaktotal
)
{
peaktotal
=
history_totals
.
recv
[
i
]
+
history_totals
.
sent
[
i
];
}
}
y
=
3
;
...
...
@@ -226,7 +245,7 @@ void ui_print() {
int
x
=
0
,
L
;
host_pair_line
*
screen_line
=
(
host_pair_line
*
)
nn
->
data
;
if
(
y
<
LINES
-
5
)
{
if
(
y
<
LINES
-
4
)
{
int
t
;
L
=
(
COLS
-
8
*
HISTORY_DIVISIONS
-
4
)
/
2
;
...
...
@@ -273,14 +292,27 @@ void ui_print() {
y
=
LINES
-
2
;
mvaddstr
(
y
,
0
,
"sent peak: "
);
mvaddstr
(
y
+
1
,
0
,
"recv "
);
mvaddstr
(
y
,
0
,
"total: "
);
mvaddstr
(
y
+
1
,
0
,
" peak: "
);
readable_size
((
totals
.
recv
[
0
]
+
totals
.
sent
[
0
])
*
8
/
RESOLUTION
,
line
,
10
,
1024
);
mvaddstr
(
y
,
8
,
line
);
readable_size
(
peaktotal
*
8
/
RESOLUTION
,
line
,
10
,
1024
);
mvaddstr
(
y
+
1
,
8
,
line
);
readable_size
((
peakrecv
+
peaksent
)
*
8
/
RESOLUTION
,
line
,
10
,
1024
);
mvaddstr
(
y
+
1
,
8
,
line
);
mvaddstr
(
y
,
17
,
"sent: peak: "
);
mvaddstr
(
y
+
1
,
17
,
"recv: "
);
readable_size
(
peaksent
*
8
/
RESOLUTION
,
line
,
10
,
1024
);
mvaddstr
(
y
,
15
,
line
);
mvaddstr
(
y
,
30
,
line
);
readable_size
(
peakrecv
*
8
/
RESOLUTION
,
line
,
10
,
1024
);
mvaddstr
(
y
+
1
,
15
,
line
);
mvaddstr
(
y
+
1
,
30
,
line
);
mvaddstr
(
y
,
COLS
-
8
*
HISTORY_DIVISIONS
-
10
,
"totals:"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment