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

@ -1,4 +1,4 @@
// See the file "COPYING" in the main distribution directory for copyright.
// See the file "COPYING" in the main distribution directory for copyright.
#ifndef dnsmgr_h
#define dnsmgr_h
@ -81,6 +81,17 @@ public:
void AsyncLookupAddr(dns_mgr_addr_type host, LookupCallback* callback);
void AsyncLookupName(string name, LookupCallback* callback);
struct Stats {
unsigned long requests; // These count only async requests.
unsigned long successful;
unsigned long failed;
unsigned long pending;
unsigned long cached_hosts;
unsigned long cached_addresses;
};
void GetStats(Stats* stats);
protected:
friend class LookupCallback;
friend class DNS_Mgr_Request;
@ -206,6 +217,10 @@ protected:
TimeoutQueue asyncs_timeouts;
int asyncs_pending;
unsigned long num_requests;
unsigned long successful;
unsigned long failed;
};
extern DNS_Mgr* dns_mgr;