]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Use 5% critical region for number of runs
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 17 Aug 2010 15:49:16 +0000 (17:49 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 17 Aug 2010 15:52:19 +0000 (17:52 +0200)
This results in more samples used in regression and slightly improved
response with high jitters.

regress.c

index 6913fed319dadbaa76024cf0b39aac7404a9900a..7adbb107388131f719458b4a95d1dfcc7ea40cc5 100644 (file)
--- a/regress.c
+++ b/regress.c
@@ -172,23 +172,23 @@ typedef struct {
 } RegressionResult;
 
 /* ================================================== */
-/* Critical value for number of runs of residuals with same sign.  10%
-   critical region for now */
-
-static char critical_runs10[] = {
-  0,  0,  0,  0,  0,  0,  0,  0,  3,  3, 
-  4,  4,  4,  5,  5,  6,  6,  6,  7,  7, 
-  8,  8,  9,  9,  9, 10, 10, 11, 11, 12, 
- 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 
- 17, 17, 17, 18, 18, 19, 19, 20, 20, 21, 
- 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 
- 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 
- 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 
- 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 
- 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 
- 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 
- 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 
- 54, 54, 54, 55, 55, 56, 56, 57, 57, 58
+/* Critical value for number of runs of residuals with same sign.
+   5% critical region for now. */
+
+static char critical_runs[] = {
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,
+  3,  3,  4,  4,  5,  5,  5,  6,  6,  7,
+  7,  7,  8,  8,  9,  9,  9, 10, 10, 11,
+ 11, 11, 12, 12, 13, 13, 14, 14, 14, 15,
+ 15, 16, 16, 17, 17, 18, 18, 18, 19, 19,
+ 20, 20, 21, 21, 21, 22, 22, 23, 23, 24,
+ 24, 25, 25, 26, 26, 26, 27, 27, 28, 28,
+ 29, 29, 30, 30, 30, 31, 31, 32, 32, 33,
+ 33, 34, 34, 35, 35, 35, 36, 36, 37, 37,
+ 38, 38, 39, 39, 40, 40, 40, 41, 41, 42,
+ 42, 43, 43, 44, 44, 45, 45, 46, 46, 46,
+ 47, 47, 48, 48, 49, 49, 50, 50, 51, 51,
+ 52, 52, 52, 53, 53, 54, 54, 55, 55, 56
 };
 
 /* ================================================== */
@@ -260,7 +260,7 @@ RGR_FindBestRegression
   int i;
 
   assert(n <= MAX_POINTS);
-  assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs10) / sizeof (critical_runs10[0]));
+  assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs) / sizeof (critical_runs[0]));
 
   if (n < MIN_SAMPLES_FOR_REGRESS) {
     return 0;
@@ -300,7 +300,7 @@ RGR_FindBestRegression
     /* Count number of runs */
     nruns = n_runs_from_residuals(resid, n - resid_start); 
 
-    if (nruns > critical_runs10[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) {
+    if (nruns > critical_runs[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) {
       break;
     } else {
       /* Try dropping one sample at a time until the runs test passes. */
@@ -637,7 +637,7 @@ RGR_FindBestRobustRegression
 
     nruns = n_runs_from_residuals(resids + start, n_points);
 
-    if (nruns > critical_runs10[n_points]) {
+    if (nruns > critical_runs[n_points]) {
       break;
     } else {
       start++;