return rra_defs;
}
-void init_cdp(const rrd_t *rrd, const rra_def_t *rra_def, cdp_prep_t *cdp_prep)
+void init_cdp(const rrd_t *rrd, const rra_def_t *rra_def, const pdp_prep_t *pdp_prep, cdp_prep_t *cdp_prep)
{
switch (cf_conv(rra_def->cf_nam)) {
/* startup missing pdp count */
cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt =
((rrd->live_head->last_up -
- rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
+ pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
% (rrd->stat_head->pdp_step
* rra_def->pdp_cnt)) / rrd->stat_head->pdp_step;
break;
for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
- init_cdp(rrd, &(rrd->rra_def[i]), rrd->cdp_prep);
+ init_cdp(rrd, &(rrd->rra_def[i]), rrd->pdp_prep, rrd->cdp_prep);
for (ii = 0; ii < rrd->stat_head->ds_cnt; ii++) {
rrd_write(rrd_file_dn, rrd->cdp_prep, sizeof(cdp_prep_t));
long unsigned int *rra_cnt,
unsigned long hash);
+/** Initialize a cdp_prep structure. The rra_def, pdp_prep and cdp_prep should
+ correspond to each other. Global values are taken from rrd. */
void init_cdp(const rrd_t *rrd,
- const rra_def_t *rra_def,
+ const rra_def_t *rra_def,
+ const pdp_prep_t *pdp_prep,
cdp_prep_t *cdp_prep);
int write_rrd(const char *outfilename, rrd_t *out);
init_cdp(out,
out->rra_def + out->stat_head->rra_cnt,
+ out->pdp_prep + ii,
cdp_prep);
ii++;
break;
cdp_prep_t *cdp_prep = out->cdp_prep + start_cdp_index_out + i;
memcpy(cdp_prep, &empty_cdp_prep, sizeof(cdp_prep_t));
- init_cdp(out, rra_def, cdp_prep);
+ init_cdp(out, rra_def, out->pdp_prep + i, cdp_prep);
if (chosen_candidate && mapped_i != -1) {
int ds_cnt = chosen_candidate->rrd->stat_head->ds_cnt;