mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +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
|
## addition factor for each heartbeat
|
||||||
const addfactor = 0 &redef;
|
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 spread: count;
|
||||||
const autospread: double;
|
const autospread: double;
|
||||||
const addfactor: count;
|
const addfactor: count;
|
||||||
|
const stopspreadat: count;
|
||||||
|
const timedspread: count;
|
||||||
|
|
|
@ -26,6 +26,8 @@ Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend)
|
||||||
spread = int(BifConst::InputBenchmark::spread);
|
spread = int(BifConst::InputBenchmark::spread);
|
||||||
add = int(BifConst::InputBenchmark::addfactor);
|
add = int(BifConst::InputBenchmark::addfactor);
|
||||||
autospread_time = 0;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
heartbeatstarttime = CurrTime();
|
||||||
DoUpdate();
|
DoUpdate();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,12 +100,23 @@ bool Benchmark::DoUpdate() {
|
||||||
SendEntry(field);
|
SendEntry(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( stopspreadat == 0 || num_lines < stopspreadat ) {
|
||||||
if ( spread != 0 )
|
if ( spread != 0 )
|
||||||
usleep(spread);
|
usleep(spread);
|
||||||
|
|
||||||
if ( autospread_time != 0 ) {
|
if ( autospread_time != 0 )
|
||||||
usleep( autospread_time );
|
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 ) {
|
if ( mode != STREAM ) {
|
||||||
|
@ -215,6 +229,7 @@ bool Benchmark::DoHeartbeat(double network_time, double current_time)
|
||||||
ReaderBackend::DoHeartbeat(network_time, current_time);
|
ReaderBackend::DoHeartbeat(network_time, current_time);
|
||||||
num_lines = (int) ( (double) num_lines*multiplication_factor);
|
num_lines = (int) ( (double) num_lines*multiplication_factor);
|
||||||
num_lines += add;
|
num_lines += add;
|
||||||
|
heartbeatstarttime = CurrTime();
|
||||||
|
|
||||||
switch ( mode ) {
|
switch ( mode ) {
|
||||||
case MANUAL:
|
case MANUAL:
|
||||||
|
|
|
@ -43,6 +43,9 @@ private:
|
||||||
double autospread;
|
double autospread;
|
||||||
int autospread_time;
|
int autospread_time;
|
||||||
int add;
|
int add;
|
||||||
|
int stopspreadat;
|
||||||
|
double heartbeatstarttime;
|
||||||
|
int timedspread;
|
||||||
|
|
||||||
string RandomString(const int len);
|
string RandomString(const int len);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue