| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- /*
- **************************************************************************
- * DHRYSTONE 2.1 BENCHMARK PC VERSION
- **************************************************************************
- *
- * "DHRYSTONE" Benchmark Program
- * -----------------------------
- *
- * Version: C, Version 2.1
- *
- * File: dhry.h (part 1 of 3)
- *
- * Date: May 25, 1988
- *
- * Author: Reinhold P. Weicker
- * Siemens AG, AUT E 51
- * Postfach 3220
- * 8520 Erlangen
- * Germany (West)
- * Phone: [+49]-9131-7-20330
- * (8-17 Central European Time)
- * Usenet: ..!mcsun!unido!estevax!weicker
- *
- * Original Version (in Ada) published in
- * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
- * pp. 1013 - 1030, together with the statistics
- * on which the distribution of statements etc. is based.
- *
- * In this C version, the following C library functions are used:
- * - strcpy, strcmp (inside the measurement loop)
- * - printf, scanf (outside the measurement loop)
- * In addition, Berkeley UNIX system calls "times ()" or "time ()"
- * are used for execution time measurement. For measurements
- * on other systems, these calls have to be changed.
- *
- * Collection of Results:
- * Reinhold Weicker (address see above) and
- *
- * Rick Richardson
- * PC Research. Inc.
- * 94 Apple Orchard Drive
- * Tinton Falls, NJ 07724
- * Phone: (201) 389-8963 (9-17 EST)
- * Usenet: ...!uunet!pcrat!rick
- *
- * Please send results to Rick Richardson and/or Reinhold Weicker.
- * Complete information should be given on hardware and software used.
- * Hardware information includes: Machine type, CPU, type and size
- * of caches; for microprocessors: clock frequency, memory speed
- * (number of wait states).
- * Software information includes: Compiler (and runtime library)
- * manufacturer and version, compilation switches, OS version.
- * The Operating System version may give an indication about the
- * compiler; Dhrystone itself performs no OS calls in the measurement
- * loop.
- *
- * The complete output generated by the program should be mailed
- * such that at least some checks for correctness can be made.
- *
- **************************************************************************
- *
- * This version has changes made by Roy Longbottom to conform to a common
- * format for a series of standard benchmarks for PCs:
- *
- * Running time greater than 5 seconds due to inaccuracy of the PC clock.
- *
- * Automatic adjustment of run time, no manually inserted parameters.
- *
- * Initial display of calibration times to confirm linearity.
- *
- * Display of results within one screen (or at a slow speed as the test
- * progresses) so that it can be seen to have run successfully.
- *
- * Facilities to type in details of system used etc.
- *
- * All results and details appended to a results file.
- *
- *
- * Roy Longbottom
- * 101323.2241@compuserve.com
- *
- **************************************************************************
- *
- * For details of history, changes, other defines, benchmark construction
- * statistics see official versions from ftp.nosc.mil/pub/aburto where
- * the latest table of results (dhry.tbl) are available. See also
- * netlib@ornl.gov
- *
- **************************************************************************
- *
- * Defines: The following "Defines" are possible:
- * -DREG=register (default: Not defined)
- * As an approximation to what an average C programmer
- * might do, the "register" storage class is applied
- * (if enabled by -DREG=register)
- * - for local variables, if they are used (dynamically)
- * five or more times
- * - for parameters if they are used (dynamically)
- * six or more times
- * Note that an optimal "register" strategy is
- * compiler-dependent, and that "register" declarations
- * do not necessarily lead to faster execution.
- * -DNOSTRUCTASSIGN (default: Not defined)
- * Define if the C compiler does not support
- * assignment of structures.
- * -DNOENUMS (default: Not defined)
- * Define if the C compiler does not support
- * enumeration types.
- ***************************************************************************
- *
- * Compilation model and measurement (IMPORTANT):
- *
- * This C version of Dhrystone consists of three files:
- * - dhry.h (this file, containing global definitions and comments)
- * - dhry_1.c (containing the code corresponding to Ada package Pack_1)
- * - dhry_2.c (containing the code corresponding to Ada package Pack_2)
- *
- * The following "ground rules" apply for measurements:
- * - Separate compilation
- * - No procedure merging
- * - Otherwise, compiler optimizations are allowed but should be indicated
- * - Default results are those without register declarations
- * See the companion paper "Rationale for Dhrystone Version 2" for a more
- * detailed discussion of these ground rules.
- *
- * For 16-Bit processors (e.g. 80186, 80286), times for all compilation
- * models ("small", "medium", "large" etc.) should be given if possible,
- * together with a definition of these models for the compiler system used.
- *
- **************************************************************************
- * Examples of Pentium Results
- *
- * Dhrystone Benchmark Version 2.1 (Language: C)
- *
- * Month run 4/1996
- * PC model Escom
- * CPU Pentium
- * Clock MHz 100
- * Cache 256K
- * Options Neptune chipset
- * OS/DOS Windows 95
- * Compiler Watcom C/ C++ 10.5 Win386
- * OptLevel -otexan -zp8 -fp5 -5r
- * Run by Roy Longbottom
- * From UK
- * Mail 101323.2241@compuserve.com
- *
- * Final values (* implementation-dependent):
- *
- * Int_Glob: O.K. 5
- * Bool_Glob: O.K. 1
- * Ch_1_Glob: O.K. A
- * Ch_2_Glob: O.K. B
- * Arr_1_Glob[8]: O.K. 7
- * Arr_2_Glob8/7: O.K. 1600010
- * Ptr_Glob->
- * Ptr_Comp: * 98008
- * Discr: O.K. 0
- * Enum_Comp: O.K. 2
- * Int_Comp: O.K. 17
- * Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
- * Next_Ptr_Glob->
- * Ptr_Comp: * 98008 same as above
- * Discr: O.K. 0
- * Enum_Comp: O.K. 1
- * Int_Comp: O.K. 18
- * Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
- * Int_1_Loc: O.K. 5
- * Int_2_Loc: O.K. 13
- * Int_3_Loc: O.K. 7
- * Enum_Loc: O.K. 1
- * Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
- * Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
- *
- * Register option Selected.
- *
- * Microseconds 1 loop: 4.53
- * Dhrystones / second: 220690
- * VAX MIPS rating: 125.61
- *
- *
- * Dhrystone Benchmark Version 2.1 (Language: C)
- *
- * Month run 4/1996
- * PC model Escom
- * CPU Pentium
- * Clock MHz 100
- * Cache 256K
- * Options Neptune chipset
- * OS/DOS Windows 95
- * Compiler Watcom C/ C++ 10.5 Win386
- * OptLevel No optimisation
- * Run by Roy Longbottom
- * From UK
- * Mail 101323.2241@compuserve.com
- *
- * Final values (* implementation-dependent):
- *
- * Int_Glob: O.K. 5
- * Bool_Glob: O.K. 1
- * Ch_1_Glob: O.K. A
- * Ch_2_Glob: O.K. B
- * Arr_1_Glob[8]: O.K. 7
- * Arr_2_Glob8/7: O.K. 320010
- * Ptr_Glob->
- * Ptr_Comp: * 98004
- * Discr: O.K. 0
- * Enum_Comp: O.K. 2
- * Int_Comp: O.K. 17
- * Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
- * Next_Ptr_Glob->
- * Ptr_Comp: * 98004 same as above
- * Discr: O.K. 0
- * Enum_Comp: O.K. 1
- * Int_Comp: O.K. 18
- * Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
- * Int_1_Loc: O.K. 5
- * Int_2_Loc: O.K. 13
- * Int_3_Loc: O.K. 7
- * Enum_Loc: O.K. 1
- * Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
- * Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
- *
- * Register option Not selected.
- *
- * Microseconds 1 loop: 20.06
- * Dhrystones / second: 49844
- * VAX MIPS rating: 28.37
- *
- **************************************************************************
- */
- /* Compiler and system dependent definitions: */
- #ifndef TIME
- #define TIMES
- #endif
- /* Use times(2) time function unless */
- /* explicitly defined otherwise */
- #ifdef TIMES
- /* #include <sys/types.h>
- #include <sys/times.h> */
- /* for "times" */
- #endif
- #define Mic_secs_Per_Second 1000000.0
- /* Berkeley UNIX C returns process times in seconds/HZ */
- #ifdef NOSTRUCTASSIGN
- #define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
- #else
- #define structassign(d, s) d = s
- #endif
- #ifdef NOENUM
- #define Ident_1 0
- #define Ident_2 1
- #define Ident_3 2
- #define Ident_4 3
- #define Ident_5 4
- typedef int Enumeration;
- #else
- typedef enum { Ident_1, Ident_2, Ident_3, Ident_4, Ident_5 } Enumeration;
- #endif
- /* for boolean and enumeration types in Ada, Pascal */
- /* General definitions: */
- #include <stdio.h>
- #include <string.h>
- /* for strcpy, strcmp */
- #define Null 0
- /* Value of a Null pointer */
- #define true 1
- #define false 0
- typedef int One_Thirty;
- typedef int One_Fifty;
- typedef char Capital_Letter;
- typedef int Boolean;
- typedef char Str_30[31];
- typedef int Arr_1_Dim[50];
- typedef int Arr_2_Dim[50][50];
- typedef struct record {
- struct record *Ptr_Comp;
- Enumeration Discr;
- union {
- struct {
- Enumeration Enum_Comp;
- int Int_Comp;
- char Str_Comp[31];
- } var_1;
- struct {
- Enumeration E_Comp_2;
- char Str_2_Comp[31];
- } var_2;
- struct {
- char Ch_1_Comp;
- char Ch_2_Comp;
- } var_3;
- } variant;
- } Rec_Type, *Rec_Pointer;
|