mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Change how input/logging threads set their name.
Setting the thread name on every heartbeat uses a mild amount of cycles and there's not much benefit to doing it there to get the additional info regarding the number of processed messages since thread names usually get truncated to 16 characters and omit that part anyway.
This commit is contained in:
parent
cb4eaf762c
commit
c9b40f1ca7
4 changed files with 4 additions and 10 deletions
|
@ -215,6 +215,8 @@ bool ReaderBackend::Init(const int arg_num_fields,
|
||||||
if ( Failed() )
|
if ( Failed() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SetOSName(Fmt("bro: %s", Name()));
|
||||||
|
|
||||||
num_fields = arg_num_fields;
|
num_fields = arg_num_fields;
|
||||||
fields = arg_fields;
|
fields = arg_fields;
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ void WriterBackend::DisableFrontend()
|
||||||
|
|
||||||
bool WriterBackend::Init(int arg_num_fields, const Field* const* arg_fields)
|
bool WriterBackend::Init(int arg_num_fields, const Field* const* arg_fields)
|
||||||
{
|
{
|
||||||
|
SetOSName(Fmt("bro: %s", Name()));
|
||||||
num_fields = arg_num_fields;
|
num_fields = arg_num_fields;
|
||||||
fields = arg_fields;
|
fields = arg_fields;
|
||||||
|
|
||||||
|
|
|
@ -254,15 +254,6 @@ void MsgThread::Heartbeat()
|
||||||
SendIn(new HeartbeatMessage(this, network_time, current_time()));
|
SendIn(new HeartbeatMessage(this, network_time, current_time()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MsgThread::HeartbeatInChild()
|
|
||||||
{
|
|
||||||
string n = Fmt("bro: %s (%" PRIu64 "/%" PRIu64 ")", Name(),
|
|
||||||
cnt_sent_in - queue_in.Size(),
|
|
||||||
cnt_sent_out - queue_out.Size());
|
|
||||||
|
|
||||||
SetOSName(n.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MsgThread::Finished()
|
void MsgThread::Finished()
|
||||||
{
|
{
|
||||||
child_finished = true;
|
child_finished = true;
|
||||||
|
|
|
@ -199,7 +199,7 @@ protected:
|
||||||
|
|
||||||
/** Internal heartbeat processing. Called from child.
|
/** Internal heartbeat processing. Called from child.
|
||||||
*/
|
*/
|
||||||
void HeartbeatInChild();
|
void HeartbeatInChild() {}
|
||||||
|
|
||||||
/** Returns true if a child command has reported a failure. In that case, we'll
|
/** Returns true if a child command has reported a failure. In that case, we'll
|
||||||
* be in the process of killing this thread and no further activity
|
* be in the process of killing this thread and no further activity
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue