summaryrefslogtreecommitdiff
path: root/benchmarks/hbench/patches/patch-an
blob: b9b4cf3499b6bed700871eba8aeb8c0c3251bca1 (plain)
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
# $NetBSD: patch-an,v 1.1 2005/03/03 08:53:06 garbled Exp $
--- ./src/timing.c      Fri Jun 27 04:52:29 1997
+++ work/hbench-OS/src/timing.c       Wed Aug 14 14:11:22 2002
@@ -201,19 +201,24 @@
 #ifdef DEBUG
 	printf(">> %d 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 %d iterations\n", num);
 #endif
-			break;
+			return num;
 		}
 #ifdef DEBUG
 		printf(">> %d iterations gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
 #endif
+	}
+	while (time < 1000000.) {
+		/* while less than one second */
+		num <<= 1;
+		time *= 2;
 	}
 #ifdef DEBUG
 	printf(">> Choosing %d iterations\n",num);