mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/log-threads-configureable-heartbeat' into topic/bernhard/input-threads
Conflicts: src/threading/Manager.h
This commit is contained in:
commit
e789724935
6 changed files with 18 additions and 5 deletions
|
@ -1484,6 +1484,14 @@ export {
|
|||
};
|
||||
} # end export
|
||||
|
||||
module Threading;
|
||||
|
||||
export {
|
||||
## The heart beat interval used by the threading framework.
|
||||
## Changing this should usually not be neccessary and will break several tests.
|
||||
const heart_beat_interval = 1.0 secs &redef;
|
||||
}
|
||||
|
||||
module GLOBAL;
|
||||
|
||||
## An NTP message.
|
||||
|
|
|
@ -12,3 +12,4 @@ const NFS3::return_data: bool;
|
|||
const NFS3::return_data_max: count;
|
||||
const NFS3::return_data_first_only: bool;
|
||||
|
||||
const Threading::heart_beat_interval: interval;
|
||||
|
|
|
@ -89,7 +89,7 @@ double Benchmark::CurrTime() {
|
|||
|
||||
// read the entire file and send appropriate thingies back to InputMgr
|
||||
bool Benchmark::DoUpdate() {
|
||||
int linestosend = num_lines * threading::Manager::HEART_BEAT_INTERVAL;
|
||||
int linestosend = num_lines * heart_beat_interval;
|
||||
for ( int i = 0; i < linestosend; i++ ) {
|
||||
Value** field = new Value*[num_fields];
|
||||
for (unsigned int j = 0; j < num_fields; j++ ) {
|
||||
|
@ -117,7 +117,7 @@ bool Benchmark::DoUpdate() {
|
|||
diff = CurrTime() - heartbeatstarttime;
|
||||
//printf("%d %f\n", i, diff);
|
||||
//} while ( diff < i/threading::Manager::HEART_BEAT_INTERVAL*(num_lines + (num_lines * timedspread) ) );
|
||||
} while ( diff/threading::Manager::HEART_BEAT_INTERVAL < i/(linestosend + (linestosend * timedspread) ) );
|
||||
} while ( diff/heart_beat_interval < i/(linestosend + (linestosend * timedspread) ) );
|
||||
//} while ( diff < 0.8);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
int stopspreadat;
|
||||
double heartbeatstarttime;
|
||||
double timedspread;
|
||||
double heart_beat_interval;
|
||||
|
||||
string RandomString(const int len);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "Manager.h"
|
||||
#include "NetVar.h"
|
||||
|
||||
using namespace threading;
|
||||
|
||||
|
@ -11,6 +12,9 @@ Manager::Manager()
|
|||
next_beat = 0;
|
||||
terminating = false;
|
||||
idle = true;
|
||||
|
||||
heart_beat_interval = double(BifConst::Threading::heart_beat_interval);
|
||||
DBG_LOG(DBG_THREADING, "Heart beat interval set to %f", heart_beat_interval);
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
|
@ -74,7 +78,7 @@ void Manager::GetFds(int* read, int* write, int* except)
|
|||
double Manager::NextTimestamp(double* network_time)
|
||||
{
|
||||
if ( ::network_time && ! next_beat )
|
||||
next_beat = ::network_time + HEART_BEAT_INTERVAL;
|
||||
next_beat = ::network_time + heart_beat_interval;
|
||||
|
||||
// fprintf(stderr, "N %.6f %.6f did_process=%d next_next=%.6f\n", ::network_time, timer_mgr->Time(), (int)did_process, next_beat);
|
||||
|
||||
|
|
|
@ -124,9 +124,8 @@ protected:
|
|||
*/
|
||||
virtual const char* Tag() { return "threading::Manager"; }
|
||||
|
||||
static const int HEART_BEAT_INTERVAL = 10;
|
||||
|
||||
private:
|
||||
int heart_beat_interval;
|
||||
|
||||
typedef std::list<BasicThread*> all_thread_list;
|
||||
all_thread_list all_threads;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue