2013-09-26 17:14:40 +02:00

40 lines
1.1 KiB
Plaintext

$NetBSD: patch-an,v 1.3 2011/09/12 11:15:33 dholland Exp $
Speed up the loop calibration.
--- src/timing.c.orig 2011-09-12 10:54:05.000000000 +0000
+++ src/timing.c
@@ -252,15 +252,15 @@ gen_iterations(workfn, clkmul)
#ifdef DEBUG
printf(">> %u iteration gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
#endif
- while ((time = ((float)rtntime)*clkmul) < 1000000.) {
- /* while less than one second */
- num <<= 1;
+ while ((time = ((float)rtntime)*clkmul) < 1000000./16) {
+ /* while less than 1/16 second */
+ num <<= 2;
if ((*workfn)(num, &rtntime) != 0) {
num >>= 1;
#ifdef DEBUG
- printf(">> backing off\n");
+ printf(">> backing off to %u iterations\n", num);
#endif
- break;
+ return num;
}
#ifdef DEBUG
printf(">> %u iterations gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
@@ -271,6 +271,11 @@ gen_iterations(workfn, clkmul)
exit(1);
}
}
+ while (time < 1000000.) {
+ /* while less than one second */
+ num <<= 1;
+ time *= 2;
+ }
#ifdef DEBUG
printf(">> Choosing %u iterations\n", num);
#endif