Remove unnecessary wait state from frequency estimator.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-09-02 14:33:44 +02:00
parent 843661dfa2
commit 8a4b2ab9b8
1 changed files with 21 additions and 15 deletions

10
clock.c
View File

@ -199,6 +199,11 @@ static enum servo_state clock_no_adjust(struct clock *c)
* By leaving out the path delay altogther, we can avoid the
* error caused by our imperfect path delay measurement.
*/
if (!f->ingress1) {
f->ingress1 = c->t2;
f->origin1 = tmv_add(c->t1, tmv_add(c->c1, c->c2));
return state;
}
f->count++;
if (f->count < f->max_count) {
return state;
@ -207,9 +212,10 @@ static enum servo_state clock_no_adjust(struct clock *c)
* origin2 = c->t1 (+c->path_delay) + c->c1 + c->c2;
*/
origin2 = tmv_add(c->t1, tmv_add(c->c1, c->c2));
if (f->ingress1) {
ratio = tmv_dbl(tmv_sub(origin2, f->origin1)) /
tmv_dbl(tmv_sub(c->t2, f->ingress1));
pr_info("master offset %10lld s%d ratio %.9f path delay %10lld",
c->master_offset, state, ratio, c->path_delay);
@ -223,7 +229,7 @@ static enum servo_state clock_no_adjust(struct clock *c)
pr_debug("sum-1 %.9f", fui + c->nrr - 1.0);
pr_debug("master/local %.9f", ratio);
pr_debug("diff %+.9f", ratio - (fui + c->nrr - 1.0));
}
f->ingress1 = c->t2;
f->origin1 = origin2;
f->count = 0;