Page 1 of 1

Re: [Nagios-devel] Event Profiler Timers?

Posted: Tue Jun 09, 2009 3:56 pm
by Guest
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 [email protected]
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.





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]