Public interface for the Moving Average predictor. More...
#include <linux/aquosa/rres_config.h>
#include <linux/aquosa/qres_config.h>
#include <linux/aquosa/qos_debug.h>
Go to the source code of this file.
Defines | |
#define | MOVAVG_DEF_SAMPLESIZE 3 |
Default sample size. | |
#define | MOVAVG_DEF_FORGETF 1.0 |
Default forgetting factor. | |
Functions | |
qos_rv | movavg_set_defaults (void) |
Configures a Moving Average predictor with default parameters. | |
qos_rv | movavg_set_sample_size (int sample_size) |
Sets the sample size for the Moving Average predictor. | |
qos_rv | movavg_set_forget_f (float ff) |
Sets a forgetting factor lower than 1. | |
qos_rv | movavg_register_lib (void) |
Registration of the submodule with the library. |
Public interface for the Moving Average predictor.
A Moving Average predictor computes the expected value of the next sample as a moving average on a fixed number of last execution times. The size of the moving window on the past samples sequence is expected to be provided by the application. Precisely, if N denotes the size of the moving window, and are the N last observed samples at step k, then the expected value
, returned by the get_exp_value() function, computes
Actually, it is possible to specify more than 1 moving average to be used. This is possible by cascading the movavg predictor with the multipred predictor. See documentation for multipred_t for details.
If a forgetting factor lower than 1 is used, then the samples are averaged by using exponentially reducing weights, with higher weights for recent samples and lower weights for older ones. Precisely, denoting with the forgetting factor and with N the sample size, the formula for prediction
at step k is
In the same example as above, with a factor of 0.5, the expected value for sample k is computed approximatively as (0.5714*x(k-2)+0.2857*x(k-4)+0.1429*x(k-6))/3. The used weights always sum to 1.
Definition in file movavg_lib.h.
qos_rv movavg_register_lib | ( | void | ) |
Registration of the submodule with the library.