diff --git a/Changelog b/Changelog index 030aacc..1de6ab4 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,10 @@ Changelog +15/08/04 (Fabian) +-Totals (in curses mode) + +------------------------------------------------- + 29/07/04 (Fabian) -tracemode (-t) diff --git a/README b/README new file mode 100644 index 0000000..5c92004 --- /dev/null +++ b/README @@ -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. diff --git a/process.cpp b/process.cpp index 389b8df..fefe5c1 100644 --- a/process.cpp +++ b/process.cpp @@ -315,6 +315,7 @@ int count_processes() return i; } +// Display all processes and relevant network traffic using show function void do_refresh() { if (DEBUG || tracemode) @@ -333,7 +334,10 @@ void do_refresh() ProcList * lastproc = NULL; int nproc = count_processes(); Line * lines [nproc]; - int n = 0; + int n = 0, i = 0; + double sent_global = 0; + double recv_global = 0; + while (curproc != NULL) { // walk though its connections, summing up @@ -381,13 +385,21 @@ void do_refresh() } } qsort (lines, nproc, sizeof(Line *), GreatestFirst); - for (int i=0; ishow(i); + recv_global += lines[i]->recv_kbps; + sent_global += lines[i]->sent_kbps; 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(); + } } /* returns the process from proclist with matching pid