1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
$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
|