[rrd-developers] Implementation of temporal smoothing
ch_cu2 at yahoo.fr
ch_cu2 at yahoo.fr
Fri Sep 1 15:50:45 MEST 2006
Having a look at the source code, I can't really understand the logic of
the implementation of the temporal smoothing in rrdtool. I re-read the
spec and have no problem with them, but the implementation remains
unclear for me.
I put a copy of the code in question below.
Could someone explain me what the code is doing and why we don't simply
do a temp smoothing at, say, every burning cycle at a fixed row (which
would be fixed for each rrd file and generated randomly while it is
created). This would be much simpler... but I must miss something.
Also, why is the BURNIN_CYCLES constant set to 3?
Thanks for your help!
cheers,
Chris
Code:
/* periodically run a smoother for seasonal effects */
/* Need to use first cdp parameter buffer to track
burnin (burnin requires a specific smoothing schedule).
* The CDP_init_seasonal parameter is really an RRA
level, not a data source within RRA level parameter, but the
* rra_def is read only for rrd_update (not flushed
to disk). */
iii = i*(rrd.stat_head -> ds_cnt);
if
(rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt <= BURNIN_CYCLES)
{
if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st >
rrd.rra_def[i].row_cnt - 1)
{
/* mark off one of the burnin cycles */
++(rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt);
schedule_smooth = 1;
}
}
else
{
/* someone has no doubt invented a trick to deal
with this wrap around, but at least this code is clear. */
if
(rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt > rrd.rra_ptr[i].cur_row)
{
/* here elapsed_pdp_st = rra_step_cnt[i]
because of 1-1 mapping between PDP and CDP */
if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
>= rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
{
#ifdef DEBUG
fprintf(stderr,
"schedule_smooth 1: cur_row %lu,
elapsed_pdp_st %lu, smooth idx %lu\n",
rrd.rra_ptr[i].cur_row,
elapsed_pdp_st,
rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
#endif
schedule_smooth = 1;
}
}
else
{
/* can't rely on negative numbers because we
are working with unsigned values */
/* Don't need modulus here. If we've wrapped
more than once, only one smooth is executed at the end. */
if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
>= rrd.rra_def[i].row_cnt
&& rrd.rra_ptr[i].cur_row +
elapsed_pdp_st - rrd.rra_def[i].row_cnt
>=
rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
{
#ifdef DEBUG
fprintf(stderr,
"schedule_smooth 2: cur_row %lu,
elapsed_pdp_st %lu, smooth idx %lu\n",
rrd.rra_ptr[i].cur_row,
elapsed_pdp_st,
rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
#endif
schedule_smooth = 1;
}
}
}
p5.vert.ukl.yahoo.com uncompressed Fri Sep 1 13:27:00 GMT 2006
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://lists.ee.ethz.ch/rrd-developers
WebAdmin http://lists.ee.ethz.ch/lsg2.cgi
More information about the rrd-developers
mailing list