Re: [chrony-dev] SW/HW timestamping on Linux |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] SW/HW timestamping on Linux
- From: Denny Page <dennypage@xxxxxx>
- Date: Sun, 04 Dec 2016 22:56:57 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1480921020; bh=7LqgFtR287MHmGiqV0Qy2zvh/OMab2CuN8bwunfAPrk=; h=From:Content-type:MIME-version:Subject:Date:To:Message-id; b=BndhVAOAehKwq9WAnGdyxfC7V8zV+qp5a0ZEdUdfMG+T0ydgFH3bGnJGeTYMPMRny BJWM6qAz5OAML2OHihp/NVRQ7/qaw5g5eXFMUgVDI7GfixqC9r2m6lAvNCNwJTj5L8 QCWYOiqeLYZumUL0WX9MCCY2EK6B3hvExJcUOzgoejotJm07GZjyCu4NKtPjoWB9zL ich8Ofs3dQ24/zwg4sVMNKhSoo99Di3uWLIi+7pRdMEo8Vz+GgAPNlQuvhy63bvvhY TpwA8oX5PfTnCoYHoHkE6kqnGGiQJgn4tFuKTec8Jfr09L6OkDYq7tEXnqrY1PCcW6 OAANpoQcJ/3kw==
I’m still chasing the offset issue. However on the spikes/noise issue, the patch below addresses the noise and low level spikes that I was seeing. I was seeing errors of 2-60ns off in the average offset for the nic clock, which this corrects. I’m still seeing the occasional larger spike, but this does not appear to be related to issues with PTP_SYS_OFFSET. I’m speculating that the large spikes are associated with the kernel preemption, but haven’t had time to test this theory.
Denny
*** ntp_io_linux.c.org Wed Nov 23 08:41:54 2016
--- ntp_io_linux.c Sun Dec 4 22:32:45 2016
***************
*** 288,295 ****
{
struct ptp_sys_offset sys_off;
struct timespec ts1, ts2, ts3, phc_tss[PHC_READINGS], sys_tss[PHC_READINGS];
! double min_delay = 0.0, delays[PHC_READINGS], phc_sum, local_sum, local_prec;
! int i, n;
/* Silence valgrind */
memset(&sys_off, 0, sizeof (sys_off));
--- 288,295 ----
{
struct ptp_sys_offset sys_off;
struct timespec ts1, ts2, ts3, phc_tss[PHC_READINGS], sys_tss[PHC_READINGS];
! double delays[PHC_READINGS], delay_limit, delay_sum, offset_sum;
! int min_delay = 0, i, n;
/* Silence valgrind */
memset(&sys_off, 0, sizeof (sys_off));
***************
*** 317,344 ****
/* Step in the middle of a PHC reading? */
return 0;
! if (!i || delays[i] < min_delay)
! min_delay = delays[i];
}
- local_prec = LCL_GetSysPrecisionAsQuantum();
-
/* Combine best readings */
! for (i = n = 0, phc_sum = local_sum = 0.0; i < PHC_READINGS; i++) {
! if (delays[i] > min_delay + local_prec)
continue;
! phc_sum += UTI_DiffTimespecsToDouble(&phc_tss[i], &phc_tss[0]);
! local_sum += UTI_DiffTimespecsToDouble(&sys_tss[i], &sys_tss[0]) + delays[i] / 2.0;
n++;
}
assert(n);
! UTI_AddDoubleToTimespec(&phc_tss[0], phc_sum / n, phc_ts);
! UTI_AddDoubleToTimespec(&sys_tss[0], local_sum / n, &ts1);
LCL_CookTime(&ts1, local_ts, NULL);
! *p_delay = min_delay;
return 1;
}
--- 317,345 ----
/* Step in the middle of a PHC reading? */
return 0;
! if (delays[i] < delays[min_delay])
! min_delay = i;
}
/* Combine best readings */
! delay_limit = delays[min_delay] * 1.1;
! for (i = n = 0, delay_sum = offset_sum = 0.0; i < PHC_READINGS; i++) {
! if (delays[i] > delay_limit)
continue;
! delay_sum += delays[i];
! UTI_AddDoubleToTimespec(&sys_tss[i], delays[i] / 2.0, &ts1);
! offset_sum += UTI_DiffTimespecsToDouble(&phc_tss[i], &ts1);
n++;
}
assert(n);
! ts1 = sys_tss[min_delay];
! UTI_AddDoubleToTimespec(&ts1, offset_sum / n, phc_ts);
!
LCL_CookTime(&ts1, local_ts, NULL);
! *p_delay = delays[min_delay];
return 1;
}
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.