rrd_version
rrd_write
rrd_xport
+rrd_reduce_data
+rrd_lcd
+rrd_cf_conv
rrdc_connect
rrdc_is_connected
rrdc_is_any_connected
case 0:
if (sscanf(token, CF_NAM_FMT, rra_def->cf_nam) != 1)
rrd_set_error("Failed to parse CF name");
- cf_id = cf_conv(rra_def->cf_nam);
+ cf_id = rrd_cf_conv(rra_def->cf_nam);
switch (cf_id) {
case CF_MHWPREDICT:
if (*require_version == NULL || atoi(*require_version) < atoi(RRD_VERSION4)) {
rra_def->pdp_cnt = 1;
break;
case 1:
- switch (cf_conv
+ switch (rrd_cf_conv
(rra_def->cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
}
break;
case 2:
- switch (cf_conv
+ switch (rrd_cf_conv
(rra_def->cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
}
break;
case 3:
- switch (cf_conv(rra_def->cf_nam)) {
+ switch (rrd_cf_conv(rra_def->cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2
}
break;
case 4:
- switch (cf_conv(rra_def->cf_nam)) {
+ switch (rrd_cf_conv(rra_def->cf_nam)) {
case CF_FAILURES:
/* specifies the index (1-based) of CF_DEVSEASONAL array
* associated with this CF_DEVFAILURES array. */
rra_def_t *rra_def = rra_def_array + (*rra_cnt-1);
/* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */
- if ((cf_conv(rra_def->cf_nam) == CF_HWPREDICT
- || cf_conv(rra_def->cf_nam) == CF_MHWPREDICT)
+ if ((rrd_cf_conv(rra_def->cf_nam) == CF_HWPREDICT
+ || rrd_cf_conv(rra_def->cf_nam) == CF_MHWPREDICT)
&& rra_def->par[RRA_dependent_rra_idx].u_cnt == INT_MAX) {
rra_def->par[RRA_dependent_rra_idx].u_cnt = *rra_cnt-1;
#ifdef DEBUG
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)) {
+ switch (rrd_cf_conv(rra_def->cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
init_hwpredict_cdp(cdp_prep);
}
static int order_candidates(candidate_t *a, candidate_t *b, const candidate_t UNUSED(*target)) {
- enum cf_en acf = cf_conv(a->rra->cf_nam);
- enum cf_en bcf = cf_conv(b->rra->cf_nam);
+ enum cf_en acf = rrd_cf_conv(a->rra->cf_nam);
+ enum cf_en bcf = rrd_cf_conv(b->rra->cf_nam);
- enum cf_en tcf = cf_conv(target->rra->cf_nam);
+ enum cf_en tcf = rrd_cf_conv(target->rra->cf_nam);
int astep = a->rrd->stat_head->pdp_step;
int bstep = b->rrd->stat_head->pdp_step;
/* select AVERAGE and same CF RRAs. */
static int select_create_candidates(const rra_def_t *tofill, const rra_def_t *maybe) {
- enum cf_en cf = cf_conv(maybe->cf_nam);
+ enum cf_en cf = rrd_cf_conv(maybe->cf_nam);
if (cf == CF_AVERAGE) return 1;
- if (cf == cf_conv(tofill->cf_nam)) return 1;
+ if (cf == rrd_cf_conv(tofill->cf_nam)) return 1;
return 0;
}
(target->cdp + target->extra.l)->scratch[CDP_unkn_pdp_cnt].u_cnt = 0;
- enum cf_en tcf = cf_conv(target->rra->cf_nam);
+ enum cf_en tcf = rrd_cf_conv(target->rra->cf_nam);
time_t t;
rra_def_t *cdp_rra = rrd->rra_def + cdp_rra_index;
original_total_rows += rra->row_cnt;
largest_pdp = max(largest_pdp, rra->pdp_cnt);
- if (rra->pdp_cnt == 1 && cf_conv(rra->cf_nam) == CF_AVERAGE) {
+ if (rra->pdp_cnt == 1 && rrd_cf_conv(rra->cf_nam) == CF_AVERAGE) {
if (average_1_pdp_rra == NULL) {
average_1_pdp_rra = rra;
found_rra_index = rra_index;
}
static int cdp_match(const rra_def_t *tofill, const rra_def_t *maybe) {
- enum cf_en mcf = cf_conv(maybe->cf_nam);
- if (cf_conv(tofill->cf_nam) == mcf &&
+ enum cf_en mcf = rrd_cf_conv(maybe->cf_nam);
+ if (rrd_cf_conv(tofill->cf_nam) == mcf &&
tofill->pdp_cnt == maybe->pdp_cnt) {
return 1;
}
candidate_t target = {
.rrd = rrd,
.rra = rra_def,
- .rra_cf = cf_conv(rra_def->cf_nam),
+ .rra_cf = rrd_cf_conv(rra_def->cf_nam),
.rra_index = rra_index,
.values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows,
.cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * rra_index,
candidate_t target = {
.rrd = rrd,
.rra = rrd->rra_def + rra_index,
- .rra_cf = cf_conv(rrd->rra_def[rra_index].cf_nam),
+ .rra_cf = rrd_cf_conv(rrd->rra_def[rra_index].cf_nam),
.rra_index = rra_index,
.values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows,
.cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * rra_index,
/* support for RRA parameters */
CB_PUTS("\t\t<params>\n");
- switch (cf_conv(rrd.rra_def[i].cf_nam)) {
+ switch (rrd_cf_conv(rrd.rra_def[i].cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
CB_FMTS("\t\t<hw_alpha>%0.10e</hw_alpha>\n",
CB_FMTS("\t\t\t<secondary_value>%0.10e</secondary_value>\n", value);
}
- switch (cf_conv(rrd.rra_def[i].cf_nam)) {
+ switch (rrd_cf_conv(rrd.rra_def[i].cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
value = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].
{ /* two dimensional array containing the data */
enum cf_en cf_idx;
- if ((int) (cf_idx = cf_conv(cf)) == -1) {
+ if ((int) (cf_idx = rrd_cf_conv(cf)) == -1) {
return -1;
}
/* find the rra which best matches the requirements */
for (i = 0; (unsigned) i < rrd.stat_head->rra_cnt; i++) {
- enum cf_en rratype=cf_conv(rrd.rra_def[i].cf_nam);
+ enum cf_en rratype=rrd_cf_conv(rrd.rra_def[i].cf_nam);
/* handle this RRA */
if (
/* if we found a direct match */
}
-enum cf_en cf_conv(
+enum cf_en rrd_cf_conv(
const char *string)
{
/* reduce data reimplementation by Alex */
-int reduce_data(
+int rrd_reduce_data(
enum cf_en cf, /* which consolidation function ? */
unsigned long cur_step, /* step the data currently is in */
time_t *start, /* start, end and step as requested ... */
im->gdes[i].step = max(im->gdes[i].step,im->step);
if (ft_step < im->gdes[i].step) {
- if (!reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf,
+ if (!rrd_reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf,
ft_step,
&im->gdes[i].start,
&im->gdes[i].end,
/* find the greatest common divisor for all the numbers
in the 0 terminated num array */
-long lcd(
+long rrd_lcd(
long *num)
{
long rest;
/* Now find the resulting step. All steps in all
* used RRAs have to be visited
*/
- im->gdes[gdi].step = lcd(steparray);
+ im->gdes[gdi].step = rrd_lcd(steparray);
free(steparray);
if ((im->gdes[gdi].data = (rrd_value_t*)malloc(((im->gdes[gdi].end -
long ds; /* data source number */
char daemon[256];
enum cf_en cf; /* consolidation function */
- enum cf_en cf_reduce; /* consolidation function for reduce_data() */
+ enum cf_en cf_reduce; /* consolidation function for rrd_reduce_data() */
int cf_reduce_set; /* is the cf_reduce option set */
struct gfx_color_t col, col2; /* graph color */
double gradheight;
image_desc_t *);
void apply_gridfit(
image_desc_t *);
-int reduce_data(
+int rrd_reduce_data(
enum cf_en,
unsigned long,
time_t *,
rrd_value_t **);
int data_fetch(
image_desc_t *);
-long lcd(
+long rrd_lcd(
long *);
int data_calc(
image_desc_t *);
if (bitscmp(PARSE_REDUCE)) {
char *reduce=getKeyValueArgument("reduce",1,pa);
if (reduce) {
- gdp->cf_reduce=cf_conv(reduce);
+ gdp->cf_reduce=rrd_cf_conv(reduce);
gdp->cf_reduce_set=1;
dprintfparsed("got reduce: %s (%i)\n",reduce,gdp->cf_reduce);
if (((int)gdp->cf_reduce)==-1) { rrd_set_error("bad reduce CF: %s",reduce); return NULL; }
gdp->ds_nam[DS_NAM_SIZE - 1] = '\0';
}
if (cf) {
- gdp->cf=cf_conv(cf);
+ gdp->cf=rrd_cf_conv(cf);
if (((int)gdp->cf)==-1) {
rrd_set_error("bad CF: %s",cf); return NULL; }
} else { if (bitscmp(PARSE_CF)) { gdp->cf = (enum cf_en) -1; }}
if (((int)gdp->cf)==-1) {
keyvalue_t* first=getFirstUnusedArgument(1,pa);
if (first) {
- gdp->cf=cf_conv(first->value);
+ gdp->cf=rrd_cf_conv(first->value);
if (((int)gdp->cf)==-1) {
rrd_set_error("bad CF for DEF/CDEF: %s",first->value); return 1; }
} else { rrd_set_error("No positional CDEF"); return 1; }
char *violations_array;
/* check that rra_idx is a CF_FAILURES array */
- if (cf_conv(rrd->rra_def[rra_idx].cf_nam) != CF_FAILURES) {
+ if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) != CF_FAILURES) {
#ifdef DEBUG
fprintf(stderr, "erase_violations called for non-FAILURES RRA: %s\n",
rrd->rra_def[rra_idx].cf_nam);
free(buffers);
free(working_average);
- if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
+ if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
rrd_value_t (
*init_seasonality) (
rrd_value_t seasonal_coef,
rrd_value_t intercept);
- switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
+ switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
case CF_HWPREDICT:
init_seasonality = hw_additive_init_seasonality;
break;
/* loop over the RRAs */
for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) {
cdp_idx = rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
- switch (cf_conv(rrd->rra_def[rra_idx].cf_nam)) {
+ switch (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam)) {
case CF_HWPREDICT:
case CF_MHWPREDICT:
init_hwpredict_cdp(&(rrd->cdp_prep[cdp_idx]));
return update_devpredict(rrd, cdp_idx, rra_idx, ds_idx,
CDP_scratch_idx);
case CF_SEASONAL:
- switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
+ switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
case CF_HWPREDICT:
return update_seasonal(rrd, cdp_idx, rra_idx, ds_idx,
CDP_scratch_idx, seasonal_coef,
return -1;
}
case CF_DEVSEASONAL:
- switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
+ switch (rrd_cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) {
case CF_HWPREDICT:
return update_devseasonal(rrd, cdp_idx, rra_idx, ds_idx,
CDP_scratch_idx, seasonal_coef,
return -1;
}
case CF_FAILURES:
- switch (cf_conv
+ switch (rrd_cf_conv
(rrd->rra_def[hw_dep_idx(rrd, hw_dep_idx(rrd, rra_idx))].
cf_nam)) {
case CF_HWPREDICT:
info.u_str = rrd.rra_def[i].cf_nam;
cd = rrd_info_push(cd, sprintf_alloc("rra[%d].cf", i), RD_I_STR,
info);
- current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+ current_cf = rrd_cf_conv(rrd.rra_def[i].cf_nam);
info.u_cnt = rrd.rra_def[i].row_cnt;
cd = rrd_info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT,
}
static int select_for_modify(const rra_def_t *tofill, const rra_def_t *maybe) {
- enum cf_en cf = cf_conv(tofill->cf_nam);
- enum cf_en other_cf = cf_conv(maybe->cf_nam);
+ enum cf_en cf = rrd_cf_conv(tofill->cf_nam);
+ enum cf_en other_cf = rrd_cf_conv(maybe->cf_nam);
return (other_cf == cf ||
(other_cf == CF_AVERAGE /*&& other_rra->pdp_cnt == 1*/));
}
.rra_index = i,
.values = rrd->rrd_value + rrd->stat_head->ds_cnt * total_rows,
.rra = rrd->rra_def + i,
- .rra_cf = cf_conv(rrd->rra_def[i].cf_nam),
+ .rra_cf = rrd_cf_conv(rrd->rra_def[i].cf_nam),
.ptr = rrd->rra_ptr + i,
.cdp = rrd->cdp_prep + rrd->stat_head->ds_cnt * i,
.extra = extra
if (in_rrd->stat_head->rra_cnt < 1) return 0;
- enum cf_en cf = cf_conv(new_rra->cf_nam);
+ enum cf_en cf = rrd_cf_conv(new_rra->cf_nam);
switch (cf) {
case CF_AVERAGE:
case CF_MINIMUM:
unsigned int rra_index, ds_index;
for (rra_index = 0 ; rra_index < out->stat_head->rra_cnt ; rra_index++) {
rra_def_t *rra = out->rra_def + rra_index;
- enum cf_en cf = cf_conv(rra->cf_nam);
+ enum cf_en cf = rrd_cf_conv(rra->cf_nam);
cdp_prep_t *cdp_prep_row = out->cdp_prep + rra_index * ds_cnt;
for (ds_index = 0 ; ds_index < ds_cnt ; ds_index++) {
rra_def_t *rra_def = out->rra_def + curr_rra;
- enum cf_en cf = cf_conv(rra_def->cf_nam);
+ enum cf_en cf = rrd_cf_conv(rra_def->cf_nam);
int candidates_cnt = 0;
candidate_t *candidates = NULL;
candidate_t *chosen_candidate = NULL;
rra_def_t *cand_rra = c->rrd->rra_def + c->rra_index;
// we only accept AVERAGE RRAs or RRAs with pdp_cnt == 1
- if (cand_rra->pdp_cnt == 1 || cf_conv(cand_rra->cf_nam) == CF_AVERAGE) {
+ if (cand_rra->pdp_cnt == 1 || rrd_cf_conv(cand_rra->cf_nam) == CF_AVERAGE) {
chosen_candidate = c;
break;
}
if (status != 0)
return status;
- status = cf_conv(rra_def->cf_nam);
+ status = rrd_cf_conv(rra_def->cf_nam);
if (status == -1) {
rrd_set_error("parse_tag_rra_cf: Unknown consolidation function: %s",
rra_def->cf_nam);
#define RRD_EXCL (1<<5)
#define RRD_READVALUES (1<<6)
- enum cf_en cf_conv(
+ enum cf_en rrd_cf_conv(
const char *string);
enum dst_en dst_conv(
const char *string);
}
/* does the appropriate RRA exist? */
for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
- if (cf_conv(rrd->rra_def[i].cf_nam) == cf) {
+ if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == cf) {
rra_idx = i;
break;
}
}
/* does the appropriate RRA exist? */
for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
- if (cf_conv(rrd->rra_def[i].cf_nam) == cf) {
+ if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == cf) {
rra_idx = i;
break;
}
/* does the appropriate RRA exist? */
for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
- if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
+ if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
rra_idx = i;
break;
}
}
/* does the appropriate RRA exist? */
for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
- if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
+ if (rrd_cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
rra_idx = i;
break;
}
rra_start = rra_begin;
for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) {
- current_cf = cf_conv(rrd->rra_def[rra_idx].cf_nam);
+ current_cf = rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam);
start_pdp_offset =
rrd->rra_def[rra_idx].pdp_cnt -
proc_pdp_cnt % rrd->rra_def[rra_idx].pdp_cnt;
rra_start = rra_begin;
for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) {
if (rrd->rra_def[rra_idx].pdp_cnt == 1) {
- current_cf = cf_conv(rrd->rra_def[rra_idx].cf_nam);
+ current_cf = rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam);
if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL) {
if (scratch_idx == CDP_primary_val) {
lookup_seasonal(rrd, rra_idx, rra_start, rrd_file,
unsigned long rra_idx;
for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; ++rra_idx) {
- if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_DEVSEASONAL ||
- cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
+ if (rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_DEVSEASONAL ||
+ rrd_cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
#ifdef DEBUG
fprintf(stderr, "Running smoother for rra %lu\n", rra_idx);
#endif
}
*step_list_ptr=0;
/* find a common step */
- *step = lcd(step_list);
+ *step = rrd_lcd(step_list);
/* printf("step: %lu\n",*step); */
free(step_list);