Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1238604 > unrolled thread
| Started by | John Stultz <john.stultz@linaro.org> |
|---|---|
| First post | 2015-10-02 22:50 +0200 |
| Last post | 2015-10-02 22:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 2/2 (v2)] kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments John Stultz <john.stultz@linaro.org> - 2015-10-02 22:50 +0200
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2015-10-02 22:50 +0200 |
| Subject | Re: [PATCH 2/2 (v2)] kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments |
| Message-ID | <qffrc-5YK-11@gated-at.bofh.it> |
On Mon, Sep 14, 2015 at 7:48 AM, Miroslav Lichvar <mlichvar@redhat.com> wrote: > Is there a cheap way to calculate this? > xtime_remainder * (ntp_tick >> ntp_error_shift) / NTP_INTERVAL_LENGTH So as I was trying to figure out before I prematurely hit send... I was thinking... xtime_remainder = (NTP_INTERVAL_LENGTH << tk->tkr_mono.clock->shift) - (tk->cycle_interval * tk->tkr_mono.clock->mult) or for simplification: xtime_remainder = NTP_INTERVAL_SHIFTED - ORIG_MULT_INTERVAL_SHIFTED And we want to scale it as you pointed out above (though slightly fixed here) by: (tk->ntp_tick >> tk->ntp_error_shift) / (NTP_INTERVAL_LENGTH << tk->tkr_mono.clock->shift) Which we'll simplify a touch as: (tk->ntp_tick >> tk->ntp_error_shift) / NTP_INTERVAL_SHIFTED So multiplying these comes out to: (tk->ntp_tick >> tk->ntp_error_shift) - ((tk->ntp_tick >> tk->ntp_error_shift) * ORIG_MULT_INTERVAL_SHIFTED / NTP_INTERVAL_SHIFTED) Which simplifies a bit to: (tk->ntp_tick - (tk->ntp_tick * ORIG_MULT_INTERVAL_SHIFTED / NTP_INTERVAL_SHIFTED)) >> tk->ntp_error_shift (tk->ntp_tick * ( 1 - ORIG_MULT_INTERVAL_SHIFTED / NTP_INTERVAL_SHIFTED)) >> tk->ntp_error_shift; So this looks like it would be cheap to calculate, but since we're doing integer math, the problem is that ORIG_MULT_INTERVAL_SHIFTED / NTP_INTERVAL_SHIFTED isn't an integer value, so if we want any precision we'd still have the costly tk->ntp_tick/NTP_INTERVAL_SHIFTED to do each time. So.. that's a long winded way to say I can't think of a cheap way.... :P thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web