Profiling support for DNS_Mgr and triggers.

With misc/profiling.bro, both now report a line in prof.log with some
counters on usage.
This commit is contained in:
Robin Sommer 2011-10-09 16:28:46 -07:00
parent bd9c937236
commit df4a22a27d
6 changed files with 77 additions and 2 deletions

View file

@ -110,6 +110,8 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
is_return = arg_is_return;
location = arg_location;
++total_triggers;
DBG_LOG(DBG_NOTIFIERS, "%s: instantiating", Name());
if ( is_return )
@ -165,6 +167,7 @@ void Trigger::Init()
}
Trigger::TriggerList* Trigger::pending = 0;
unsigned long Trigger::total_triggers = 0;
bool Trigger::Eval()
{
@ -413,3 +416,9 @@ const char* Trigger::Name()
return fmt("%s:%d-%d", location->filename,
location->first_line, location->last_line);
}
void Trigger::GetStats(Stats* stats)
{
stats->total = total_triggers;
stats->pending = pending ? pending->size() : 0;
}