build as lib - work in progress

This commit is contained in:
Mohamed Boussaffa
2016-03-04 00:09:51 +08:00
parent 0b4ba231c0
commit 730a5c2624
3 changed files with 6 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ else
# Release mode options # Release mode options
ODIR:=$(ODIR_BASE)/release ODIR:=$(ODIR_BASE)/release
CFLAGS?=-Wall -Wextra -O3 -fPIC $(VISIBILITY) CFLAGS?=-Wall -Wextra -O3 -fPIC $(VISIBILITY)
CXXFLAGS?=---std=c++11 Wall -Wextra -O3 -fPIC $(VISIBILITY) $(CXXINCLUDES) CXXFLAGS?=-Wall --std=c++11 -Wextra -O3 -fPIC $(VISIBILITY) $(CXXINCLUDES)
endif endif
OBJ_NAMES= libnethogs.o packet.o connection.o process.o refresh.o decpcap.o inode2prog.o conninode.o devices.o OBJ_NAMES= libnethogs.o packet.o connection.o process.o refresh.o decpcap.o inode2prog.o conninode.o devices.o

View File

@@ -81,7 +81,6 @@ void NethogsMonitor::threadProc()
fprintf(stderr, "Waiting for first packet to arrive (see sourceforge.net bug 1019381)\n"); fprintf(stderr, "Waiting for first packet to arrive (see sourceforge.net bug 1019381)\n");
struct dpargs * userdata = (dpargs *) malloc (sizeof (struct dpargs)); struct dpargs * userdata = (dpargs *) malloc (sizeof (struct dpargs));
time_t last_event_time = 0;
// Main loop: // Main loop:
// Walks though the 'handles' list, which contains handles opened in non-blocking mode. // Walks though the 'handles' list, which contains handles opened in non-blocking mode.
// This causes the CPU utilisation to go up to 100%. This is tricky: // This causes the CPU utilisation to go up to 100%. This is tricky:
@@ -110,7 +109,6 @@ void NethogsMonitor::threadProc()
if ( packets_read && needrefresh ) if ( packets_read && needrefresh )
{ {
needrefresh = false; needrefresh = false;
last_event_time = dp_get_lasttime();
handleUpdate(); handleUpdate();
} }
@@ -149,6 +147,9 @@ void NethogsMonitor::handleUpdate()
{ {
if (DEBUG) if (DEBUG)
std::cout << "PROC: Deleting process\n"; std::cout << "PROC: Deleting process\n";
monitor_data.apps_info.erase(curproc->getVal()->name);
ProcList * todelete = curproc; ProcList * todelete = curproc;
Process * p_todelete = curproc->getVal(); Process * p_todelete = curproc->getVal();
if (previousproc) if (previousproc)

View File

@@ -22,7 +22,8 @@ class NETHOGS_DSO_VISIBLE NethogsMonitorData
float sent_kbs; float sent_kbs;
float recv_kbs; float recv_kbs;
}; };
std::map<std::string, Line> apps_info; typedef std::map<std::string, Line> TAppMap;
TAppMap apps_info;
}; };
class NETHOGS_DSO_VISIBLE NethogsMonitor class NETHOGS_DSO_VISIBLE NethogsMonitor