def __init__(self, window_size, drop_every_nth, false_pos_prob, max_consecutive, max_thresh, ewma): assert drop_every_nth > 0 assert false_pos_prob > 0.0 and false_pos_prob < 1.0 assert max_consecutive > 1 assert max_thresh > 0.0 and max_thresh < 1.0 assert ewma > 0.0 and ewma < 1.0 # parameters self._window_size = window_size self._false_pos_prob = false_pos_prob self._max_consecutive = max_consecutive self._thresh = max_thresh # estimators self._window = SizedList(window_size) self._propagation_estimator = \ MedianOfMinWindow(window_size, drop_every_nth) self._delay_on_full_estimator = \ MedianOfMaxWindow(window_size, drop_every_nth) self._cond_var = EWMA(alpha=ewma) # variance when uncongested. self._cond_mean = EWMA(alpha=ewma) # mean when uncongested. # counters self._init_samples = 0 # count of first samples. self._consecutive = 0 # consecutive samples above the threshold. # computed thresholds self._n = None self._thresh = None if stats: prop_vs_time = os.path.join(stats_dir, "prop_vs_time.plotdata") fp = open(prop_vs_time, "w") self._propagation_estimator = \ StreamTracer( self._propagation_estimator, fp ) full_vs_time = os.path.join(stats_dir, "full_vs_time.plotdata") fp = open(full_vs_time, "w") self._delay_on_full_estimator = \ StreamTracer( self._delay_on_full_estimator, fp ) cmean_vs_time = os.path.join(stats_dir, "cmean_vs_time.plotdata") fp = open(cmean_vs_time, "w") self._cond_mean = StreamTracer(self._cond_mean, fp) cvar_vs_time = os.path.join(stats_dir, "cvar_vs_time.plotdata") fp = open(cvar_vs_time, "w") self._cond_var = StreamTracer(self._cond_var, fp) thresh_vs_time = os.path.join(stats_dir, "thresh_vs_time.plotdata") self._thfp = open(thresh_vs_time, "w") n_v_time = os.path.join(stats_dir, "n_vs_time.plotdata") self._nfp = open(n_vs_time, "w")
def __init__(self, window_size): self._window = SizedList(window_size) self._window_size = window_size self._max_var = 0.0 if stats: delay_var_vs_time = os.path.join(stats_dir, "delay_var_vs_time.plotdata") self._var_fp = open(delay_var_vs_time, "w") max_var_vs_time = os.path.join(stats_dir, "max_var_vs_time.plotdata") self._max_var_fp = open(max_var_vs_time, "w") _copy_gnuplot("var_vs_time.gnuplot")
def __init__(self, window_size): self._window = SizedList(window_size)