display total traffic
(traffic dropped by the kernel isn't included, so results might be less but not usually more than output by, for example, bwm)
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
15/08/04 (Fabian)
|
||||||
|
-Totals (in curses mode)
|
||||||
|
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
29/07/04 (Fabian)
|
29/07/04 (Fabian)
|
||||||
-tracemode (-t)
|
-tracemode (-t)
|
||||||
|
|
||||||
|
|||||||
23
README
Normal file
23
README
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
= NETHOGS =
|
||||||
|
|
||||||
|
http://nethogs.sf.net
|
||||||
|
|
||||||
|
== INTRODUCTION ==
|
||||||
|
|
||||||
|
NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.
|
||||||
|
|
||||||
|
Since NetHogs heavily relies on /proc, it currently runs on Linux only.
|
||||||
|
|
||||||
|
== STATUS ==
|
||||||
|
|
||||||
|
Ideas/ToDo for new releases:
|
||||||
|
|
||||||
|
* Only IPv4 TCP is currently supported
|
||||||
|
* Sort the output by other values than network usage
|
||||||
|
* Monitor specific processes
|
||||||
|
* Make it work correctly on machines with multiple IP addresses
|
||||||
|
* Integrate into another tool??
|
||||||
|
|
||||||
|
== LICENSE ==
|
||||||
|
|
||||||
|
GPL.
|
||||||
18
process.cpp
18
process.cpp
@@ -315,6 +315,7 @@ int count_processes()
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display all processes and relevant network traffic using show function
|
||||||
void do_refresh()
|
void do_refresh()
|
||||||
{
|
{
|
||||||
if (DEBUG || tracemode)
|
if (DEBUG || tracemode)
|
||||||
@@ -333,7 +334,10 @@ void do_refresh()
|
|||||||
ProcList * lastproc = NULL;
|
ProcList * lastproc = NULL;
|
||||||
int nproc = count_processes();
|
int nproc = count_processes();
|
||||||
Line * lines [nproc];
|
Line * lines [nproc];
|
||||||
int n = 0;
|
int n = 0, i = 0;
|
||||||
|
double sent_global = 0;
|
||||||
|
double recv_global = 0;
|
||||||
|
|
||||||
while (curproc != NULL)
|
while (curproc != NULL)
|
||||||
{
|
{
|
||||||
// walk though its connections, summing up
|
// walk though its connections, summing up
|
||||||
@@ -381,14 +385,22 @@ void do_refresh()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
qsort (lines, nproc, sizeof(Line *), GreatestFirst);
|
qsort (lines, nproc, sizeof(Line *), GreatestFirst);
|
||||||
for (int i=0; i<nproc; i++)
|
for (i=0; i<nproc; i++)
|
||||||
{
|
{
|
||||||
lines[i]->show(i);
|
lines[i]->show(i);
|
||||||
|
recv_global += lines[i]->recv_kbps;
|
||||||
|
sent_global += lines[i]->sent_kbps;
|
||||||
delete lines[i];
|
delete lines[i];
|
||||||
}
|
}
|
||||||
if ((!tracemode) && (!DEBUG))
|
|
||||||
|
if ((!tracemode) && (!DEBUG)){
|
||||||
|
attron(A_REVERSE);
|
||||||
|
mvprintw (3+1+i, 0, " TOTAL %10.3f %10.3f KB/sec ", sent_global, recv_global);
|
||||||
|
attroff(A_REVERSE);
|
||||||
|
mvprintw (4+1+i, 0, "");
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* returns the process from proclist with matching pid
|
/* returns the process from proclist with matching pid
|
||||||
* if none, creates it */
|
* if none, creates it */
|
||||||
|
|||||||
Reference in New Issue
Block a user