1 /*****************************************************************************
2 * RRDtool 1.0.33 Copyright Tobias Oetiker, 1997 - 2000
3 *****************************************************************************
4 * rrd_hw.h : Support for Holt-Winters Smoothing/ Aberrant Behavior Detection
5 *****************************************************************************/
7 /* functions implemented in rrd_hw.c */
8 int update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf,
9 unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx,
10 unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef);
11 int create_hw_contingent_rras(rrd_t *rrd, unsigned short period,
12 unsigned long hashed_name);
13 int lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
14 FILE *rrd_file, unsigned long offset, rrd_value_t **seasonal_coef);
15 void erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx);
16 int apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
18 void reset_aberrant_coefficients(rrd_t *rrd, FILE *rrd_file, unsigned long ds_idx);
19 void init_hwpredict_cdp(cdp_prep_t *);
20 void init_seasonal_cdp(cdp_prep_t *);
21 #define BURNIN_CYCLES 3
23 /* a standard fixed-capacity FIFO queue implementation */
24 typedef struct FIFOqueue {
26 int capacity, head, tail;
29 int queue_alloc(FIFOqueue **q,int capacity);
30 void queue_dealloc(FIFOqueue *q);
31 void queue_push(FIFOqueue *q, rrd_value_t value);
32 int queue_isempty(FIFOqueue *q);
33 rrd_value_t queue_pop(FIFOqueue *q);