1 /*****************************************************************************
2 * RRDtool 1.3.2 Copyright by Tobi Oetiker, 1997-2008
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(
9 rrd_t *rrd,
10 rrd_value_t pdp_val,
11 enum cf_en current_cf,
12 unsigned long cdp_idx,
13 unsigned long rra_idx,
14 unsigned long ds_idx,
15 unsigned short CDP_scratch_idx,
16 rrd_value_t *seasonal_coef);
17 int create_hw_contingent_rras(
18 rrd_t *rrd,
19 unsigned short period,
20 unsigned long hashed_name);
21 int lookup_seasonal(
22 rrd_t *rrd,
23 unsigned long rra_idx,
24 unsigned long rra_start,
25 rrd_file_t *rrd_file,
26 unsigned long offset,
27 rrd_value_t **seasonal_coef);
28 void erase_violations(
29 rrd_t *rrd,
30 unsigned long cdp_idx,
31 unsigned long rra_idx);
32 int apply_smoother(
33 rrd_t *rrd,
34 unsigned long rra_idx,
35 unsigned long rra_start,
36 rrd_file_t *rrd_file);
37 void reset_aberrant_coefficients(
38 rrd_t *rrd,
39 rrd_file_t *rrd_file,
40 unsigned long ds_idx);
41 void init_hwpredict_cdp(
42 cdp_prep_t *);
43 void init_seasonal_cdp(
44 cdp_prep_t *);
46 #define BURNIN_CYCLES 3
48 /* a standard fixed-capacity FIFO queue implementation */
49 typedef struct FIFOqueue {
50 rrd_value_t *queue;
51 int capacity, head, tail;
52 } FIFOqueue;
54 int queue_alloc(
55 FIFOqueue **q,
56 int capacity);
57 void queue_dealloc(
58 FIFOqueue *q);
59 void queue_push(
60 FIFOqueue *q,
61 rrd_value_t value);
62 int queue_isempty(
63 FIFOqueue *q);
64 rrd_value_t queue_pop(
65 FIFOqueue *q);