most of the stuff we should need for benchmarking. next: search memory leaks, after 1.5million simulated

inputs we are leaking about 1Gb of ram...
This commit is contained in:
Bernhard Amann 2012-03-30 09:08:08 -07:00
parent 28f3fa0144
commit 355b85fcd7
6 changed files with 34 additions and 2 deletions

View file

@ -1,4 +1,5 @@
@load ./main
@load ./readers/ascii
@load ./readers/raw
@load ./readers/benchmark

View file

@ -0,0 +1,8 @@
##! Interface for the ascii input reader.
module InputBenchmark;
export {
## multiplication factor for each second
const factor = 1 &redef;
}

View file

@ -45,3 +45,6 @@ const unset_field: string;
module InputRaw;
const record_separator: string;
module InputBenchmark;
const factor: count;

View file

@ -58,7 +58,12 @@ public:
name(name), num_vals(num_vals), val(val) {}
virtual bool Process() {
return input_mgr->SendEvent(name, num_vals, val);
bool success = input_mgr->SendEvent(name, num_vals, val);
if ( !success )
reporter->Error("SendEvent for event %s failed", name.c_str());
return true; // we do not want to die if sendEvent fails because the event did not return.
}
private:

View file

@ -21,6 +21,7 @@ using threading::Field;
Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend)
{
multiplication_factor = int(BifConst::InputBenchmark::factor);
}
Benchmark::~Benchmark()
@ -198,6 +199,7 @@ threading::Value* Benchmark::EntryToVal(TypeTag type, TypeTag subtype) {
bool Benchmark::DoHeartbeat(double network_time, double current_time)
{
ReaderBackend::DoHeartbeat(network_time, current_time);
num_lines = num_lines*multiplication_factor;
switch ( mode ) {
case MANUAL:
@ -205,6 +207,17 @@ bool Benchmark::DoHeartbeat(double network_time, double current_time)
break;
case REREAD:
case STREAM:
if ( multiplication_factor != 1 ) {
// we have to document at what time we changed the factor to what value.
Value** v = new Value*[2];
v[0] = new Value(TYPE_COUNT, true);
v[0]->val.uint_val = num_lines;
v[1] = new Value(TYPE_TIME, true);
v[1]->val.double_val = CurrTime();
SendEvent("lines_changed", 2, v);
}
Update(); // call update and not DoUpdate, because update actually checks disabled.
break;
default:

View file

@ -38,6 +38,8 @@ private:
int mode;
int num_lines;
int multiplication_factor;
string RandomString(const int len);
};