@@@ so much mess
[mLib] / test / bench.c
index 17ed4ed..d1a00ea 100644 (file)
@@ -459,7 +459,7 @@ end:
 }
 
 int bench_measure(struct bench_timing *t_out, struct bench_state *b,
-                 bench_fn *fn, void *p)
+                 double base, bench_fn *fn, void *p)
 {
   struct bench_timer *tm = b->tm;
   struct bench_time t0, t1;
@@ -476,12 +476,16 @@ int bench_measure(struct bench_timing *t_out, struct bench_state *b,
     if (t_out->t >= 0.72*b->target_s) break;
     n *= 1.44*b->target_s/t_out->t;
   }
+  t_out->t -= n*b->clk.m + b->clk.c;
+  if (t_out->f&BTF_CYOK) t_out->cy -= n*b->cy.m + b->cy.c;
+  if (!(t_out->f&BTF_CYOK)) debug("  adjusted t' = %12g", t_out->t);
+  else debug("  adjusted t = %12g, cy = %10.0f", t_out->t, t_out->cy);
   if (!(t_out->f&BTF_CYOK))
     debug("  %g s per op; %g ops/s", t_out->t/n, n/t_out->t);
   else
     debug("  %g s (%g cy) per op; %g ops/s",
          t_out->t/n, t_out->cy/n, n/t_out->t);
-  t_out->n = n; return (0);
+  t_out->n = n*base; return (0);
 }
 
 /*----- That's all, folks -------------------------------------------------*/