mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
EventMgr: Remove queue_flare, use GetNextTimeout() instead
It can be visible overhead to call write() on the underlying pipe of the EventMgr's flare whenever the first event is enqueued during an IO loop iteration. Particularly in scenarios where there's about 1 event per packet for long lived connections and script-side event processing is fast. Given the event manager is drained anyhow at the end of the main loop, this shouldn't be needed. In fact, the EventMgr.Process() method is basically a stub. The one reason it is needed is when more events are enqueued during a drain. That, however, can be dealt with by implementing GetNextTimeout() to return 0.0 when there's more events queued. This way the main-loop's poll timeout is 0.0 and it'll continue immediately. This also allows to removes some extra code and drop the recently introduced InitPostFork() addition: Without a pipe, there's no need to recreate it.
This commit is contained in:
parent
01e305edd8
commit
46acd9168e
3 changed files with 6 additions and 23 deletions
|
@ -106,14 +106,14 @@ public:
|
|||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
double GetNextTimeout() override { return -1; }
|
||||
// Let the IO loop know when there's more events to process
|
||||
// by returning a zero-timeout.
|
||||
double GetNextTimeout() override { return head ? 0.0 : -1.0; }
|
||||
|
||||
void Process() override;
|
||||
const char* Tag() override { return "EventManager"; }
|
||||
void InitPostScript();
|
||||
|
||||
// Initialization to be done after a fork() happened.
|
||||
void InitPostFork();
|
||||
|
||||
uint64_t num_events_queued = 0;
|
||||
uint64_t num_events_dispatched = 0;
|
||||
|
||||
|
@ -127,7 +127,6 @@ protected:
|
|||
double current_ts;
|
||||
RecordVal* src_val;
|
||||
bool draining;
|
||||
detail::Flare queue_flare;
|
||||
};
|
||||
|
||||
extern EventMgr event_mgr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue