[Orca-dev] orcallator.se patches
Blair Zajac
blair at orcaware.com
Mon May 31 12:51:47 PDT 2004
Dmitry Berezin wrote:
>>Dmitry,
>>
>>I'm not comfortable yet with the timestamp modification patch. Can you
>>explain
>>what exactly you're seeing that makes you want to change this?
>
>
> Since timestamps do not exactly line up with the integer multiples of the
> interval time, when orca extracts data from RRDs, it gets "corrected"
> results (averaged data for the requested time), so in case of integer data,
> such as process counts, number of tape drives used (this came up some time
> ago), etc., the result is 5.97 tape drives or 32.93 Oracle connections, etc.
> This is of course only relevant for the daily graphs, since all other data
> is averaged anyways.
>
>
>>How much off is the timestamp? Just a couple of seconds I would guess?
>
>
> Yes. Here is the log for today from one of my systems:
>
> timestamp locltime
> 1085716800 00:00:00
> 1085717100 00:05:00
> 1085717400 00:10:00
> 1085717701 00:15:01
> 1085718001 00:20:01
> 1085718301 00:25:01
> No. The problem is inside both measure_web and
> sleep_till_and_count_new_processes. Look at my explanation of it here:
> http://www.orcaware.com/pipermail/orca-dev/2004-May/000465.html
>
> Basically, orcallator.se will sleep for 5 seconds regardless of the integer
> multiple of the interval boundary:
>
> #ifdef WATCH_CPU
> if (can_read_kernel != 0) {
> // Sleep at least 5 seconds to make a measurement.
> sleep_till1 = now + 5;
> while (now < sleep_till1) {
> sleep(sleep_till1 - now);
> now = time(0);
> }
Hi Dmitry,
Yes, we should definitely change this.
Instead of just fixing now to be an integer multiple of interval, I'd rather see
this fixed so that the calls to sleep() sleep till an integer multiple of interval.
We should also probably not just do something like
sleep(sleep_till - now)
because now with the fractional seconds may be closer to (int)(now+1) than
(int)now and after the sleep() we're much of the way into the proper second, so
by the time that now = time(0) is reached in So we could do something like this
#include <time.se>
#include <unistd.se>
timeval_t now[1];
ulong sleep_time;
gettimeofday(now, 0);
while (sleep_till > now[0].tv_sec) {
sleep_time = sleep_till - now[0].tv_sec;
sleep_time = 1000000*sleep_time - now[0].tv_usec;
usleep(sleep_time);
gettimeofday(now, 0);
}
The proper patch should fix both the measure_web and the
sleep_till_and_count_new_processes code paths.
There's a lot of different places in orcallator.se where sleep() is called. I
think we should have a single function that sleeps till the specified time that
all these different locations call.
I'm going to be working on orca.pl itself, so if you want to put together a
patch with this more proper fix, let me know.
Best,
Blair
--
Blair Zajac <blair at orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/
More information about the Orca-dev
mailing list