Commit c1d1be51 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename rtt-exponential-decay to rtt-decay.

parent c589c129
...@@ -340,7 +340,7 @@ is non-zero (see below), and ...@@ -340,7 +340,7 @@ is non-zero (see below), and
.B false .B false
otherwise. otherwise.
.TP .TP
.BI rtt\-exponential\-decay " decay" .BI rtt\-decay " decay"
This specifies the decay factor for the exponential moving average of This specifies the decay factor for the exponential moving average of
RTT samples, in units of 1/256. Must be between 1 and 256, inclusive. RTT samples, in units of 1/256. Must be between 1 and 256, inclusive.
Higher values discard old samples faster. The default is Higher values discard old samples faster. The default is
......
...@@ -470,12 +470,12 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure, ...@@ -470,12 +470,12 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
if(c < -1) if(c < -1)
goto error; goto error;
if_conf->enable_timestamps = v; if_conf->enable_timestamps = v;
} else if(strcmp(token, "rtt-exponential-decay") == 0) { } else if(strcmp(token, "rtt-decay") == 0) {
int decay; int decay;
c = getint(c, &decay, gnc, closure); c = getint(c, &decay, gnc, closure);
if(c < -1 || decay <= 0 || decay > 256) if(c < -1 || decay <= 0 || decay > 256)
goto error; goto error;
if_conf->rtt_exponential_decay = decay; if_conf->rtt_decay = decay;
} else if(strcmp(token, "rtt-min") == 0) { } else if(strcmp(token, "rtt-min") == 0) {
int rtt; int rtt;
c = getthousands(c, &rtt, gnc, closure); c = getthousands(c, &rtt, gnc, closure);
...@@ -575,7 +575,7 @@ merge_ifconf(struct interface_conf *dest, ...@@ -575,7 +575,7 @@ merge_ifconf(struct interface_conf *dest,
MERGE(faraway); MERGE(faraway);
MERGE(channel); MERGE(channel);
MERGE(enable_timestamps); MERGE(enable_timestamps);
MERGE(rtt_exponential_decay); MERGE(rtt_decay);
MERGE(rtt_min); MERGE(rtt_min);
MERGE(rtt_max); MERGE(rtt_max);
MERGE(max_rtt_penalty); MERGE(max_rtt_penalty);
......
...@@ -305,9 +305,9 @@ interface_up(struct interface *ifp, int up) ...@@ -305,9 +305,9 @@ interface_up(struct interface *ifp, int up)
IF_CONF(ifp, update_interval) : IF_CONF(ifp, update_interval) :
ifp->hello_interval * 4; ifp->hello_interval * 4;
ifp->rtt_exponential_decay = ifp->rtt_decay =
IF_CONF(ifp, rtt_exponential_decay) > 0 ? IF_CONF(ifp, rtt_decay) > 0 ?
IF_CONF(ifp, rtt_exponential_decay) : 42; IF_CONF(ifp, rtt_decay) : 42;
ifp->rtt_min = ifp->rtt_min =
IF_CONF(ifp, rtt_min) > 0 ? IF_CONF(ifp, rtt_min) > 0 ?
......
...@@ -38,7 +38,7 @@ struct interface_conf { ...@@ -38,7 +38,7 @@ struct interface_conf {
char faraway; char faraway;
int channel; int channel;
int enable_timestamps; int enable_timestamps;
unsigned int rtt_exponential_decay; unsigned int rtt_decay;
unsigned int rtt_min; unsigned int rtt_min;
unsigned int rtt_max; unsigned int rtt_max;
unsigned int max_rtt_penalty; unsigned int max_rtt_penalty;
...@@ -99,7 +99,7 @@ struct interface { ...@@ -99,7 +99,7 @@ struct interface {
unsigned update_interval; unsigned update_interval;
/* A higher value means we forget old RTT samples faster. Must be /* A higher value means we forget old RTT samples faster. Must be
between 1 and 256, inclusive. */ between 1 and 256, inclusive. */
unsigned int rtt_exponential_decay; unsigned int rtt_decay;
/* Parameters for computing the cost associated to RTT. */ /* Parameters for computing the cost associated to RTT. */
unsigned int rtt_min; unsigned int rtt_min;
unsigned int rtt_max; unsigned int rtt_max;
......
...@@ -618,8 +618,8 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -618,8 +618,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
old_rttcost = neighbour_rttcost(neigh); old_rttcost = neighbour_rttcost(neigh);
if (valid_rtt(neigh)) { if (valid_rtt(neigh)) {
/* Running exponential average. */ /* Running exponential average. */
smoothed_rtt = (ifp->rtt_exponential_decay * rtt smoothed_rtt = (ifp->rtt_decay * rtt +
+ (256 - ifp->rtt_exponential_decay) * neigh->rtt); (256 - ifp->rtt_decay) * neigh->rtt);
/* Rounding (up or down) to get closer to the sample. */ /* Rounding (up or down) to get closer to the sample. */
neigh->rtt = (neigh->rtt >= rtt) ? smoothed_rtt / 256 : neigh->rtt = (neigh->rtt >= rtt) ? smoothed_rtt / 256 :
(smoothed_rtt + 255) / 256; (smoothed_rtt + 255) / 256;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment