2
**************************************************************************
3
* DHRYSTONE 2.1 BENCHMARK PC VERSION
4
**************************************************************************
6
* "DHRYSTONE" Benchmark Program
7
* -----------------------------
9
* Version: C, Version 2.1
11
* File: dhry.h (part 1 of 3)
15
* Author: Reinhold P. Weicker
16
* Siemens AG, AUT E 51
20
* Phone: [+49]-9131-7-20330
21
* (8-17 Central European Time)
22
* Usenet: ..!mcsun!unido!estevax!weicker
24
* Original Version (in Ada) published in
25
* "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
26
* pp. 1013 - 1030, together with the statistics
27
* on which the distribution of statements etc. is based.
29
* In this C version, the following C library functions are used:
30
* - strcpy, strcmp (inside the measurement loop)
31
* - printf, scanf (outside the measurement loop)
32
* In addition, Berkeley UNIX system calls "times ()" or "time ()"
33
* are used for execution time measurement. For measurements
34
* on other systems, these calls have to be changed.
36
* Collection of Results:
37
* Reinhold Weicker (address see above) and
41
* 94 Apple Orchard Drive
42
* Tinton Falls, NJ 07724
43
* Phone: (201) 389-8963 (9-17 EST)
44
* Usenet: ...!uunet!pcrat!rick
46
* Please send results to Rick Richardson and/or Reinhold Weicker.
47
* Complete information should be given on hardware and software used.
48
* Hardware information includes: Machine type, CPU, type and size
49
* of caches; for microprocessors: clock frequency, memory speed
50
* (number of wait states).
51
* Software information includes: Compiler (and runtime library)
52
* manufacturer and version, compilation switches, OS version.
53
* The Operating System version may give an indication about the
54
* compiler; Dhrystone itself performs no OS calls in the measurement
57
* The complete output generated by the program should be mailed
58
* such that at least some checks for correctness can be made.
60
**************************************************************************
62
* This version has changes made by Roy Longbottom to conform to a common
63
* format for a series of standard benchmarks for PCs:
65
* Running time greater than 5 seconds due to inaccuracy of the PC clock.
67
* Automatic adjustment of run time, no manually inserted parameters.
69
* Initial display of calibration times to confirm linearity.
71
* Display of results within one screen (or at a slow speed as the test
72
* progresses) so that it can be seen to have run successfully.
74
* Facilities to type in details of system used etc.
76
* All results and details appended to a results file.
80
* 101323.2241@compuserve.com
82
**************************************************************************
84
* For details of history, changes, other defines, benchmark construction
85
* statistics see official versions from ftp.nosc.mil/pub/aburto where
86
* the latest table of results (dhry.tbl) are available. See also
89
**************************************************************************
91
* Defines: The following "Defines" are possible:
92
* -DREG=register (default: Not defined)
93
* As an approximation to what an average C programmer
94
* might do, the "register" storage class is applied
95
* (if enabled by -DREG=register)
96
* - for local variables, if they are used (dynamically)
98
* - for parameters if they are used (dynamically)
100
* Note that an optimal "register" strategy is
101
* compiler-dependent, and that "register" declarations
102
* do not necessarily lead to faster execution.
103
* -DNOSTRUCTASSIGN (default: Not defined)
104
* Define if the C compiler does not support
105
* assignment of structures.
106
* -DNOENUMS (default: Not defined)
107
* Define if the C compiler does not support
109
***************************************************************************
111
* Compilation model and measurement (IMPORTANT):
113
* This C version of Dhrystone consists of three files:
114
* - dhry.h (this file, containing global definitions and comments)
115
* - dhry_1.c (containing the code corresponding to Ada package Pack_1)
116
* - dhry_2.c (containing the code corresponding to Ada package Pack_2)
118
* The following "ground rules" apply for measurements:
119
* - Separate compilation
120
* - No procedure merging
121
* - Otherwise, compiler optimizations are allowed but should be indicated
122
* - Default results are those without register declarations
123
* See the companion paper "Rationale for Dhrystone Version 2" for a more
124
* detailed discussion of these ground rules.
126
* For 16-Bit processors (e.g. 80186, 80286), times for all compilation
127
* models ("small", "medium", "large" etc.) should be given if possible,
128
* together with a definition of these models for the compiler system used.
130
**************************************************************************
131
* Examples of Pentium Results
133
* Dhrystone Benchmark Version 2.1 (Language: C)
140
* Options Neptune chipset
142
* Compiler Watcom C/ C++ 10.5 Win386
143
* OptLevel -otexan -zp8 -fp5 -5r
144
* Run by Roy Longbottom
146
* Mail 101323.2241@compuserve.com
148
* Final values (* implementation-dependent):
154
* Arr_1_Glob[8]: O.K. 7
155
* Arr_2_Glob8/7: O.K. 1600010
161
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
163
* Ptr_Comp: * 98008 same as above
167
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
172
* Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
173
* Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
175
* Register option Selected.
177
* Microseconds 1 loop: 4.53
178
* Dhrystones / second: 220690
179
* VAX MIPS rating: 125.61
182
* Dhrystone Benchmark Version 2.1 (Language: C)
189
* Options Neptune chipset
191
* Compiler Watcom C/ C++ 10.5 Win386
192
* OptLevel No optimisation
193
* Run by Roy Longbottom
195
* Mail 101323.2241@compuserve.com
197
* Final values (* implementation-dependent):
203
* Arr_1_Glob[8]: O.K. 7
204
* Arr_2_Glob8/7: O.K. 320010
210
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
212
* Ptr_Comp: * 98004 same as above
216
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
221
* Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
222
* Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
224
* Register option Not selected.
226
* Microseconds 1 loop: 20.06
227
* Dhrystones / second: 49844
228
* VAX MIPS rating: 28.37
230
**************************************************************************
233
/* Compiler and system dependent definitions: */
238
/* Use times(2) time function unless */
239
/* explicitly defined otherwise */
242
/* #include <sys/types.h>
243
#include <sys/times.h> */
247
#define Mic_secs_Per_Second 1000000.0
248
/* Berkeley UNIX C returns process times in seconds/HZ */
250
#ifdef NOSTRUCTASSIGN
251
#define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
253
#define structassign(d, s) d = s
262
typedef int Enumeration;
264
typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
267
/* for boolean and enumeration types in Ada, Pascal */
269
/* General definitions: */
274
/* for strcpy, strcmp */
277
/* Value of a Null pointer */
281
typedef int One_Thirty;
282
typedef int One_Fifty;
283
typedef char Capital_Letter;
285
typedef char Str_30 [31];
286
typedef int Arr_1_Dim [50];
287
typedef int Arr_2_Dim [50] [50];
289
typedef struct record
291
struct record *Ptr_Comp;
295
Enumeration Enum_Comp;
300
Enumeration E_Comp_2;
301
char Str_2_Comp [31];
308
} Rec_Type, *Rec_Pointer;