Lines Matching +full:t +full:- +full:calibration +full:- +full:data
1 /*-
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * current best-available timecounter.
54 /*- in clockcalib()
55 * The idea here is to compute a best-fit linear regression between in clockcalib()
66 * on an ongoing basis, updating all five values after each new data in clockcalib()
74 * (variance(x) * variance(y) - covariance(x, y)^2) in clockcalib()
75 * ------------------------------------------------ in clockcalib()
76 * covariance(x, y)^2 * (N - 2) in clockcalib()
81 * Finally, we need to determine when to stop gathering data. We in clockcalib()
82 * can't simply stop as soon as the computed uncertainty estimate in clockcalib()
84 * would introduce a multiple-comparisons problem (cf. sequential in clockcalib()
85 * analysis in clinical trials). Instead, we stop with N data points in clockcalib()
86 * if the estimated uncertainty of the first k data points meets our in clockcalib()
93 * we measure later in order to reduce floating-point rounding errors. in clockcalib()
98 t0 = tc->tc_get_timecount(tc) & tc->tc_counter_mask; in clockcalib()
104 /* Get a new data point. */ in clockcalib()
105 clk1 = clk() - clk0; in clockcalib()
106 t1 = tc->tc_get_timecount(tc) & tc->tc_counter_mask; in clockcalib()
108 tadj += (uint64_t)tc->tc_counter_mask + 1; in clockcalib()
110 t1 += tadj - t0; in clockcalib()
113 if (t1 > tc->tc_frequency) { in clockcalib()
114 printf("Statistical %s calibration failed! " in clockcalib()
117 printf("Falling back to slow %s calibration.\n", in clockcalib()
119 freq = (double)(tc->tc_frequency) * clk1 / t1; in clockcalib()
127 d1 = clk1 - mu_clk; in clockcalib()
129 d2 = d1 * (clk1 - mu_clk); in clockcalib()
130 va_clk += (d2 - va_clk) * inv_n; in clockcalib()
133 d1 = t1 - mu_t; in clockcalib()
135 d2 = d1 * (t1 - mu_t); in clockcalib()
136 va_t += (d2 - va_t) * inv_n; in clockcalib()
139 d2 = d1 * (clk1 - mu_clk); in clockcalib()
140 cva += (d2 - cva) * inv_n; in clockcalib()
143 * Count low-uncertainty iterations. This is a rearrangement in clockcalib()
149 if (TSC_UNCERTAINTY_SQR * (n - 2) * cva * cva > in clockcalib()
150 (va_t + 4) * (va_clk + 4) - cva * cva) in clockcalib()
157 freq = (double)(tc->tc_frequency) * cva / va_t; in clockcalib()
159 printf("Statistical %s calibration took" in clockcalib()
160 " %lu us and %lu data points\n", in clockcalib()
162 1000000.0 / tc->tc_frequency), in clockcalib()
171 * O(1 / n) time here -- long enough to avoid aliasing, but in clockcalib()
174 clk_delay = clk() + (clk() - clk0) / (n * n); in clockcalib()