mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
add first simple benchmark reader (it simply spews random data, amount of lines specified in source).
This commit is contained in:
parent
872ad195f7
commit
9732859d44
6 changed files with 256 additions and 11 deletions
47
src/input/readers/Benchmark.h
Normal file
47
src/input/readers/Benchmark.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#ifndef INPUT_READERS_BENCHMARK_H
|
||||
#define INPUT_READERS_BENCHMARK_H
|
||||
|
||||
|
||||
#include "../ReaderBackend.h"
|
||||
|
||||
namespace input { namespace reader {
|
||||
|
||||
class Benchmark : public ReaderBackend {
|
||||
public:
|
||||
Benchmark(ReaderFrontend* frontend);
|
||||
~Benchmark();
|
||||
|
||||
static ReaderBackend* Instantiate(ReaderFrontend* frontend) { return new Benchmark(frontend); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool DoInit(string path, int mode, int arg_num_fields, const threading::Field* const* fields);
|
||||
|
||||
virtual void DoFinish();
|
||||
|
||||
virtual bool DoUpdate();
|
||||
|
||||
private:
|
||||
|
||||
virtual bool DoHeartbeat(double network_time, double current_time);
|
||||
|
||||
unsigned int num_fields;
|
||||
|
||||
const threading::Field* const * fields; // raw mapping
|
||||
|
||||
threading::Value* EntryToVal(TypeTag Type, TypeTag subtype);
|
||||
|
||||
int mode;
|
||||
int num_lines;
|
||||
|
||||
string RandomString(const int len);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* INPUT_READERS_BENCHMARK_H */
|
Loading…
Add table
Add a link
Reference in a new issue