Re: [chrony-dev] [PATCH] MacOS X - Dynamic drift removal interval |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] MacOS X - Dynamic drift removal interval
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Tue, 11 Aug 2015 17:18:47 +1200
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:To:Message-Id:Date: From:Subject; bh=qqxyzAb7nGiKZgYTIFBd/aZZlh8p/cebI7kgjsF7p+I=; b=yaakcTK6qDM6 NKhA9TmJDtfsqrb7ewebl5l8t8oe+y6YmodrWVvm/TuL7mL5cEqITzuh4vykvS+HKTq+OnUqb/V0D ftuY4SXYxRo2p9LDVWaZpYVuP0Nv344QipIuJwshNBRugjhxjfnk1zf9FrKTHMxDpbJmc45mJTbH7 fXBjblkXmgKjkR+tIAicR2hPXPd2Fh6y7XPcHCAnDzGesLwFI3o280g/A9/zeJ8Z4Ld9jbnVxbyRJ bvOzdNYBwVJkAyMbGXOjksmLLQP1r2SO5ZD9rC3lepY+ha0eEewDjdsMUfcMF9IEpaueudoDwjMm8 XFCBNhwUna4xSorxegwRyA==;
- Feedback-id: 149811m:149811acx33YQ:149811sw5nu3Wx-a:SMTPCORP
> On 11/08/2015, at 12:15 am, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>
> On Thu, Aug 06, 2015 at 08:25:59PM +1200, Bryan Christianson wrote:
>> Use the kernel slew rate amd measure drift to estimate the time required to compensate
>> for the maximum error observed in the most recent sample. Use this time as the interval
>> between drift removal updates until the next sample is received.
>
>> +static void
>> +set_sync_status(int synchronised, double est_error, double max_error)
>
> Using the sync status driver function for this is a nice idea.
Thank-you. Its the only call I could find that passes offset_sd directly to the driver
>
>> +{
>> + drift_removal_interval = DRIFT_REMOVAL_INTERVAL;
>> +
>> + if (!synchronised) {
>> + return;
>> + }
>> +
>> + if (max_error > 0.0 && fabs(current_freq + kernel_slewrate) >= 1.0e-9) {
>> + drift_removal_interval = fabs(max_error / (current_freq + kernel_slewrate));
>> + drift_removal_interval = MAX(drift_removal_interval, DRIFT_REMOVAL_INTERVAL_MIN);
>> + }
>> +}
>
> Hm, it's not clear to me why is the interval a function of
> kernel_slewrate and max_error. Is that intended for the case when a
> large offset is being corrected and to not make unnecessary updates
> before the offset reaches zero?
Yes. I realise any residual is picked up in the next cycle, but my thinking was to complete the update within a cycle in order to minimise the number of wakeups.
>
> I was thinking something more for the case when the clock is already
> close to zero, set the interval as long as the offset of the clock to
> the tracked NTP time stays below est_error between the adjtime()
> updates.
>
> Something like this:
> drift_removal_interval = C1 * est_error / (fabs(current_freq) + C2);
So this is estimating the contribution of local drift to offset_sd where C1 is an estimate of the proportion of local contribution?
>
> where C is some constant between 0.0 and 1.0 and C2 is maybe 1 ppm to
> prevent getting inf or nan when current_freq is very close to zero.
I'm testing this at the moment with C1 = 0.1 (just a guess based on my drift of 22ppm and offset_sd between 20 and 150 usecs for the LAN ntp servers) and C2 = 0.5e-6 (i.e. a small fraction of my observed drift)
The LAN results look satisfactory with drift_removal_interval < 1.0 secs.
Local (NZ) based pool servers also seem to work OK with 0.9 < drift_removal_interval < 3
International (US) pool servers are also working OK - offset_sd around 5000usec and drift_removal_interval about 30 secs
I'll leave it running with US servers for a few hours to see how it behaves over a longer period.
--
Bryan Christianson
--
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.