From 56dd7918d0475df364b47b6133745bbb598536fc Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Wed, 29 Feb 2012 16:46:21 -0800 Subject: [PATCH 1/3] Adding missing includes needed on FreeBSD. --- aux/binpac | 2 +- aux/bro-aux | 2 +- aux/broccoli | 2 +- aux/broctl | 2 +- src/threading/SerialTypes.h | 4 ++++ 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aux/binpac b/aux/binpac index 43308aab47..3034da8f08 160000 --- a/aux/binpac +++ b/aux/binpac @@ -1 +1 @@ -Subproject commit 43308aab47a3357ca1885e1b6954154a2744d821 +Subproject commit 3034da8f082b61157e234237993ffd7a95be6e62 diff --git a/aux/bro-aux b/aux/bro-aux index 139cc2e1e0..f53bcb2b49 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit 139cc2e1e049c4e1cc7e95f20866102be1d3d599 +Subproject commit f53bcb2b492cb0db3dd288384040abc2ab711767 diff --git a/aux/broccoli b/aux/broccoli index d6e36c95e0..2602eb53e7 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit d6e36c95e0335f7cc081191c8612085bd12706f9 +Subproject commit 2602eb53e70d7f0afae8fac58d7636b9291974a4 diff --git a/aux/broctl b/aux/broctl index e908ba686d..954538514d 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit e908ba686dceb56065bdf569c18dd0f67f662f6b +Subproject commit 954538514d71983e7ef3f0e109960466096e1c1d diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index adff2035d7..db7dc837bd 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -4,6 +4,10 @@ using namespace std; +#include +#include +#include + #include "Type.h" #include "net_util.h" From 6429d1248adf0caa275187d8e204b52638ab3332 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Thu, 1 Mar 2012 16:00:30 -0800 Subject: [PATCH 2/3] Prevent manager from busy looping. I saw this with the new threading code but I'm wondering if it also helps with the "high CPU usage with low traffiv volume" problem. --- src/Net.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Net.cc b/src/Net.cc index d93f1e1a85..2ebbfb20ed 100644 --- a/src/Net.cc +++ b/src/Net.cc @@ -486,6 +486,8 @@ void net_run() // since Bro timers are not high-precision anyway.) if ( ! using_communication ) usleep(100000); + else + usleep(1000); // Flawfinder says about usleep: // From 554a29b3edd5e1504c5e611c7b7ff9287abae330 Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Thu, 1 Mar 2012 16:04:34 -0800 Subject: [PATCH 3/3] Preventing busy looping when no threads have been spawned. --- src/threading/Manager.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/threading/Manager.cc b/src/threading/Manager.cc index 24e100fe37..f5770e2dd8 100644 --- a/src/threading/Manager.cc +++ b/src/threading/Manager.cc @@ -10,7 +10,7 @@ Manager::Manager() did_process = true; next_beat = 0; terminating = false; - idle = false; + idle = true; } Manager::~Manager() @@ -58,6 +58,7 @@ void Manager::AddThread(BasicThread* thread) { DBG_LOG(DBG_THREADING, "Adding thread %s ...", thread->Name().c_str()); all_threads.push_back(thread); + idle = false; } void Manager::AddMsgThread(MsgThread* thread)