lkml.org 
[lkml]   [2023]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH V2 2/9] perf: Extend ABI to support post-processing monotonic raw conversion
On Mon, Feb 13, 2023 at 02:22:39PM -0800, John Stultz wrote:
> The interpoloation is pretty easy to do:
>
> do {
> start= readtsc();
> clock_gett(CLOCK_MONOTONIC_RAW, &ts);
> end = readtsc();
> delta = end-start;
> } while (delta > THRESHOLD) // make sure the reads were not preempted
> mid = start + (delta +(delta/2))/2; //round-closest
>
> and be able to get you a fairly close matching of TSC to
> CLOCK_MONOTONIC_RAW value.
>
> Once you have that mapping you can take a few samples and establish
> the linear function.

Right, this is how we do the TSC calibration in the first place, and if
NTP can achieve high correctness over a network, then surely we can do
better locally.

That is, this scheme should work for all CLOCKs, not only MONOTONIC_RAW.

\
 
 \ /
  Last update: 2023-03-27 00:23    [W:0.106 / U:1.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site