cf2f2669c6
part of, a new upstream version, but I need to talk to some people first. (I'm keeping this separate from the previous update in case it breaks stuff.) Changes: roll in parts of patch-aa and patch-aq; roll in all of patch-ar and patch-src_memsize_c; make the ARM-only adjustment from patch-ar universal; add enough volatile to make 'mhz' work more or less properly again; fix the loop calibration to bail out instead of spinning forever if things go too fast (e.g. because the compiler's optimized out the benchmark loop); various hacking and modernization to get sort of a clean compile; fix some non-stdc stringifying macros; hopefully advance the clang build a bit further.
39 lines
1.1 KiB
Text
39 lines
1.1 KiB
Text
$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
|