2 /*******************************************************************************
3 * The BYTE UNIX Benchmarks - Release 3
4 * Module: arith.c SID: 3.3 5/15/91 19:30:19
6 *******************************************************************************
7 * Bug reports, patches, comments, suggestions should be sent to:
9 * Ben Smith, Rick Grehan or Tom Yager
10 * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
12 *******************************************************************************
14 * May 12, 1989 - modified empty loops to avoid nullifying by optimizing
16 * August 28, 1990 - changed timing relationship--now returns total number
18 * November 9, 1990 - made changes suggested by Keith Cantrell
19 * (digi!kcantrel) to defeat optimization
21 * October 22, 1997 - code cleanup to remove ANSI C compiler warnings
22 * Andy Kahn <kahn@zk3.dec.com>
24 ******************************************************************************/
26 char SCCSid
[] = "@(#) @(#)arith.c:3.3 -- 5/15/91 19:30:19";
40 /* this function is called when the alarm expires */
43 fprintf(stderr
,"COUNT|%ld|1|lps\n", iter
);
47 int main(int argc
, char *argv
[])
53 printf("Usage: %s duration\n", argv
[0]);
57 duration
= atoi(argv
[1]);
59 /* set up alarm call */
60 iter
= 0; /* init iteration count */
61 wake_me(duration
, report
);
63 /* this loop will be interrupted by the alarm call */
66 /* in switching to time-based (instead of iteration-based),
67 the following statement was added. It should not skew
68 the timings too much--there was an increment and test
69 in the "while" expression above. The only difference is
70 that now we're incrementing a long instead of an int. (ty) */
72 /* the loop calls a function to insure that something is done
73 the results of the function are fed back in (just so they
74 they won't be thrown away. A loop with
75 unused assignments may get optimized out of existence */
76 result
= dumb_stuff(result
);
81 /************************** dumb_stuff *******************/
94 /* notice that the i value is always reset by the loop */
95 for (i
=2; i
<=101; i
++)