Event Profiler Timers?

Andreas Ericsson ae at op5.se
Tue Jun 9 18:55:59 CEST 2009


Steven D. Morrey wrote:
> Hi Everyone,
> 
> I've been taking a long hard look at my event profiling code and I had a thought.
> We're currently using time(&time_t) to get the function entry and exit times but is this really precise enough?

It really isn't. I expect most events complete in a lot less than a
second, yielding a skewed picture of what Nagios spends its time on.

On a side-note, time_t = time(NULL) is slightly faster in nearly
all circumstances since it doesn't require the extra seek+write
access to the RAM banks.

> Would it be better (i.e. worth the overhead), to use clock_t
> = clock() to get the entry and exit?

Could be. But then we might as well use gettimeofday() from the start
so the wrap-around case at least gets exercised a lot instead of 
every 72 minutes.

Do as you please though. I doubt if I will use this feature
myself, and once it's in place it's easier for others to extend
upon later.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects




More information about the Developers mailing list