mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
add a couple more configuration options
This commit is contained in:
parent
719540414f
commit
b47620e501
4 changed files with 30 additions and 4 deletions
|
@ -14,4 +14,10 @@ export {
|
|||
|
||||
## addition factor for each heartbeat
|
||||
const addfactor = 0 &redef;
|
||||
|
||||
## stop spreading at x lines per heartbeat
|
||||
const stopspreadat = 0 &redef;
|
||||
|
||||
## 1 -> enable timed spreading
|
||||
const timedspread = 0 &redef;
|
||||
}
|
||||
|
|
|
@ -51,3 +51,5 @@ const factor: double;
|
|||
const spread: count;
|
||||
const autospread: double;
|
||||
const addfactor: count;
|
||||
const stopspreadat: count;
|
||||
const timedspread: count;
|
||||
|
|
|
@ -26,6 +26,8 @@ Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend)
|
|||
spread = int(BifConst::InputBenchmark::spread);
|
||||
add = int(BifConst::InputBenchmark::addfactor);
|
||||
autospread_time = 0;
|
||||
stopspreadat = int(BifConst::InputBenchmark::stopspreadat);
|
||||
timedspread = int(BifConst::InputBenchmark::timedspread);
|
||||
|
||||
}
|
||||
|
||||
|
@ -54,6 +56,7 @@ bool Benchmark::DoInit(string path, int arg_mode, int arg_num_fields, const Fiel
|
|||
return false;
|
||||
}
|
||||
|
||||
heartbeatstarttime = CurrTime();
|
||||
DoUpdate();
|
||||
|
||||
return true;
|
||||
|
@ -97,12 +100,23 @@ bool Benchmark::DoUpdate() {
|
|||
SendEntry(field);
|
||||
}
|
||||
|
||||
if ( spread != 0 )
|
||||
usleep(spread);
|
||||
if ( stopspreadat == 0 || num_lines < stopspreadat ) {
|
||||
if ( spread != 0 )
|
||||
usleep(spread);
|
||||
|
||||
if ( autospread_time != 0 ) {
|
||||
usleep( autospread_time );
|
||||
if ( autospread_time != 0 )
|
||||
usleep( autospread_time );
|
||||
}
|
||||
|
||||
if ( timedspread == 1 ) {
|
||||
double diff;
|
||||
do {
|
||||
diff = CurrTime() - heartbeatstarttime;
|
||||
//printf("%d %f\n", i, diff);
|
||||
} while ( diff < i/(num_lines + (num_lines * 0.15) ) );
|
||||
//} while ( diff < 0.8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( mode != STREAM ) {
|
||||
|
@ -215,6 +229,7 @@ bool Benchmark::DoHeartbeat(double network_time, double current_time)
|
|||
ReaderBackend::DoHeartbeat(network_time, current_time);
|
||||
num_lines = (int) ( (double) num_lines*multiplication_factor);
|
||||
num_lines += add;
|
||||
heartbeatstarttime = CurrTime();
|
||||
|
||||
switch ( mode ) {
|
||||
case MANUAL:
|
||||
|
|
|
@ -43,6 +43,9 @@ private:
|
|||
double autospread;
|
||||
int autospread_time;
|
||||
int add;
|
||||
int stopspreadat;
|
||||
double heartbeatstarttime;
|
||||
int timedspread;
|
||||
|
||||
string RandomString(const int len);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue