home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.unix
- From: ben@bytepb.byte.com (Ben Smith @ BYTE)
- Subject: v25i111: BYTE Benchmarks, V3.1, Part04/04
- Sender: sources-moderator@pa.dec.com
- Approved: vixie@pa.dec.com
-
- Submitted-By: ben@bytepb.byte.com (Ben Smith @ BYTE)
- Posting-Number: Volume 25, Issue 111
- Archive-Name: byte-benchmarks3.1/part04
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 4 (of 4)."
- # Contents: src/dhry.h
- # Wrapped by vixie@cognition.pa.dec.com on Sun Feb 2 16:27:41 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'src/dhry.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'src/dhry.h'\"
- else
- echo shar: Extracting \"'src/dhry.h'\" \(18918 characters\)
- sed "s/^X//" >'src/dhry.h' <<'END_OF_FILE'
- X/*****************************************************************************
- X * The BYTE UNIX Benchmarks - Release 3
- X * Module: dhry.h SID: 3.4 5/15/91 19:30:21
- X *
- X *****************************************************************************
- X * Bug reports, patches, comments, suggestions should be sent to:
- X *
- X * Ben Smith, Rick Grehan or Tom Yager
- X * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
- X *
- X *****************************************************************************
- X * Modification Log:
- X * addapted from:
- X *
- X *
- X * "DHRYSTONE" Benchmark Program
- X * -----------------------------
- X *
- X * Version: C, Version 2.1
- X *
- X * File: dhry.h (part 1 of 3)
- X *
- X * Date: May 25, 1988
- X *
- X * Author: Reinhold P. Weicker
- X * Siemens AG, AUT E 51
- X * Postfach 3220
- X * 8520 Erlangen
- X * Germany (West)
- X * Phone: [+49]-9131-7-20330
- X * (8-17 Central European Time)
- X * Usenet: ..!mcvax!unido!estevax!weicker
- X *
- X * Original Version (in Ada) published in
- X * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
- X * pp. 1013 - 1030, together with the statistics
- X * on which the distribution of statements etc. is based.
- X *
- X * In this C version, the following C library functions are used:
- X * - strcpy, strcmp (inside the measurement loop)
- X * - printf, scanf (outside the measurement loop)
- X * In addition, Berkeley UNIX system calls "times ()" or "time ()"
- X * are used for execution time measurement. For measurements
- X * on other systems, these calls have to be changed.
- X *
- X * Collection of Results:
- X * Reinhold Weicker (address see above) and
- X *
- X * Rick Richardson
- X * PC Research. Inc.
- X * 94 Apple Orchard Drive
- X * Tinton Falls, NJ 07724
- X * Phone: (201) 834-1378 (9-17 EST)
- X * Usenet: ...!seismo!uunet!pcrat!rick
- X *
- X * Please send results to Rick Richardson and/or Reinhold Weicker.
- X * Complete information should be given on hardware and software used.
- X * Hardware information includes: Machine type, CPU, type and size
- X * of caches; for microprocessors: clock frequency, memory speed
- X * (number of wait states).
- X * Software information includes: Compiler (and runtime library)
- X * manufacturer and version, compilation switches, OS version.
- X * The Operating System version may give an indication about the
- X * compiler; Dhrystone itself performs no OS calls in the measurement loop.
- X *
- X * The complete output generated by the program should be mailed
- X * such that at least some checks for correctness can be made.
- X *
- X ***************************************************************************
- X *
- X * History: This version C/2.1 has been made for two reasons:
- X *
- X * 1) There is an obvious need for a common C version of
- X * Dhrystone, since C is at present the most popular system
- X * programming language for the class of processors
- X * (microcomputers, minicomputers) where Dhrystone is used most.
- X * There should be, as far as possible, only one C version of
- X * Dhrystone such that results can be compared without
- X * restrictions. In the past, the C versions distributed
- X * by Rick Richardson (Version 1.1) and by Reinhold Weicker
- X * had small (though not significant) differences.
- X *
- X * 2) As far as it is possible without changes to the Dhrystone
- X * statistics, optimizing compilers should be prevented from
- X * removing significant statements.
- X *
- X * This C version has been developed in cooperation with
- X * Rick Richardson (Tinton Falls, NJ), it incorporates many
- X * ideas from the "Version 1.1" distributed previously by
- X * him over the UNIX network Usenet.
- X * I also thank Chaim Benedelac (National Semiconductor),
- X * David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
- X * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
- X * for their help with comments on earlier versions of the
- X * benchmark.
- X *
- X * Changes: In the initialization part, this version follows mostly
- X * Rick Richardson's version distributed via Usenet, not the
- X * version distributed earlier via floppy disk by Reinhold Weicker.
- X * As a concession to older compilers, names have been made
- X * unique within the first 8 characters.
- X * Inside the measurement loop, this version follows the
- X * version previously distributed by Reinhold Weicker.
- X *
- X * At several places in the benchmark, code has been added,
- X * but within the measurement loop only in branches that
- X * are not executed. The intention is that optimizing compilers
- X * should be prevented from moving code out of the measurement
- X * loop, or from removing code altogether. Since the statements
- X * that are executed within the measurement loop have NOT been
- X * changed, the numbers defining the "Dhrystone distribution"
- X * (distribution of statements, operand types and locality)
- X * still hold. Except for sophisticated optimizing compilers,
- X * execution times for this version should be the same as
- X * for previous versions.
- X *
- X * Since it has proven difficult to subtract the time for the
- X * measurement loop overhead in a correct way, the loop check
- X * has been made a part of the benchmark. This does have
- X * an impact - though a very minor one - on the distribution
- X * statistics which have been updated for this version.
- X *
- X * All changes within the measurement loop are described
- X * and discussed in the companion paper "Rationale for
- X * Dhrystone version 2".
- X *
- X * Because of the self-imposed limitation that the order and
- X * distribution of the executed statements should not be
- X * changed, there are still cases where optimizing compilers
- X * may not generate code for some statements. To a certain
- X * degree, this is unavoidable for small synthetic benchmarks.
- X * Users of the benchmark are advised to check code listings
- X * whether code is generated for all statements of Dhrystone.
- X *
- X * Version 2.1 is identical to version 2.0 distributed via
- X * the UNIX network Usenet in March 1988 except that it corrects
- X * some minor deficiencies that were found by users of version 2.0.
- X * The only change within the measurement loop is that a
- X * non-executed "else" part was added to the "if" statement in
- X * Func_3, and a non-executed "else" part removed from Proc_3.
- X *
- X ***************************************************************************
- X *
- X * Defines: The following "Defines" are possible:
- X * -DREG=register (default: Not defined)
- X * As an approximation to what an average C programmer
- X * might do, the "register" storage class is applied
- X * (if enabled by -DREG=register)
- X * - for local variables, if they are used (dynamically)
- X * five or more times
- X * - for parameters if they are used (dynamically)
- X * six or more times
- X * Note that an optimal "register" strategy is
- X * compiler-dependent, and that "register" declarations
- X * do not necessarily lead to faster execution.
- X * -DNOSTRUCTASSIGN (default: Not defined)
- X * Define if the C compiler does not support
- X * assignment of structures.
- X * -DNOENUMS (default: Not defined)
- X * Define if the C compiler does not support
- X * enumeration types.
- X * -DTIMES (default)
- X * -DTIME
- X * The "times" function of UNIX (returning process times)
- X * or the "time" function (returning wallclock time)
- X * is used for measurement.
- X * For single user machines, "time ()" is adequate. For
- X * multi-user machines where you cannot get single-user
- X * access, use the "times ()" function. If you have
- X * neither, use a stopwatch in the dead of night.
- X * "printf"s are provided marking the points "Start Timer"
- X * and "Stop Timer". DO NOT use the UNIX "time(1)"
- X * command, as this will measure the total time to
- X * run this program, which will (erroneously) include
- X * the time to allocate storage (malloc) and to perform
- X * the initialization.
- X * -DHZ=nnn
- X * In Berkeley UNIX, the function "times" returns process
- X * time in 1/HZ seconds, with HZ = 60 for most systems.
- X * CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY
- X * A VALUE.
- X *
- X ***************************************************************************
- X *
- X * Compilation model and measurement (IMPORTANT):
- X *
- X * This C version of Dhrystone consists of three files:
- X * - dhry.h (this file, containing global definitions and comments)
- X * - dhry_1.c (containing the code corresponding to Ada package Pack_1)
- X * - dhry_2.c (containing the code corresponding to Ada package Pack_2)
- X *
- X * The following "ground rules" apply for measurements:
- X * - Separate compilation
- X * - No procedure merging
- X * - Otherwise, compiler optimizations are allowed but should be indicated
- X * - Default results are those without register declarations
- X * See the companion paper "Rationale for Dhrystone Version 2" for a more
- X * detailed discussion of these ground rules.
- X *
- X * For 16-Bit processors (e.g. 80186, 80286), times for all compilation
- X * models ("small", "medium", "large" etc.) should be given if possible,
- X * together with a definition of these models for the compiler system used.
- X *
- X **************************************************************************
- X *
- X * Dhrystone (C version) statistics:
- X *
- X * [Comment from the first distribution, updated for version 2.
- X * Note that because of language differences, the numbers are slightly
- X * different from the Ada version.]
- X *
- X * The following program contains statements of a high level programming
- X * language (here: C) in a distribution considered representative:
- X *
- X * assignments 52 (51.0 %)
- X * control statements 33 (32.4 %)
- X * procedure, function calls 17 (16.7 %)
- X *
- X * 103 statements are dynamically executed. The program is balanced with
- X * respect to the three aspects:
- X *
- X * - statement type
- X * - operand type
- X * - operand locality
- X * operand global, local, parameter, or constant.
- X *
- X * The combination of these three aspects is balanced only approximately.
- X *
- X * 1. Statement Type:
- X * ----------------- number
- X *
- X * V1 = V2 9
- X * (incl. V1 = F(..)
- X * V = Constant 12
- X * Assignment, 7
- X * with array element
- X * Assignment, 6
- X * with record component
- X * --
- X * 34 34
- X *
- X * X = Y +|-|"&&"|"|" Z 5
- X * X = Y +|-|"==" Constant 6
- X * X = X +|- 1 3
- X * X = Y *|/ Z 2
- X * X = Expression, 1
- X * two operators
- X * X = Expression, 1
- X * three operators
- X * --
- X * 18 18
- X *
- X * if .... 14
- X * with "else" 7
- X * without "else" 7
- X * executed 3
- X * not executed 4
- X * for ... 7 | counted every time
- X * while ... 4 | the loop condition
- X * do ... while 1 | is evaluated
- X * switch ... 1
- X * break 1
- X * declaration with 1
- X * initialization
- X * --
- X * 34 34
- X *
- X * P (...) procedure call 11
- X * user procedure 10
- X * library procedure 1
- X * X = F (...)
- X * function call 6
- X * user function 5
- X * library function 1
- X * --
- X * 17 17
- X * ---
- X * 103
- X *
- X * The average number of parameters in procedure or function calls
- X * is 1.82 (not counting the function values as implicit parameters).
- X *
- X *
- X * 2. Operators
- X * ------------
- X * number approximate
- X * percentage
- X *
- X * Arithmetic 32 50.8
- X *
- X * + 21 33.3
- X * - 7 11.1
- X * * 3 4.8
- X * / (int div) 1 1.6
- X *
- X * Comparison 27 42.8
- X *
- X * == 9 14.3
- X * /= 4 6.3
- X * > 1 1.6
- X * < 3 4.8
- X * >= 1 1.6
- X * <= 9 14.3
- X *
- X * Logic 4 6.3
- X *
- X * && (AND-THEN) 1 1.6
- X * | (OR) 1 1.6
- X * ! (NOT) 2 3.2
- X *
- X * -- -----
- X * 63 100.1
- X *
- X *
- X * 3. Operand Type (counted once per operand reference):
- X * ---------------
- X * number approximate
- X * percentage
- X *
- X * Integer 175 72.3 %
- X * Character 45 18.6 %
- X * Pointer 12 5.0 %
- X * String30 6 2.5 %
- X * Array 2 0.8 %
- X * Record 2 0.8 %
- X * --- -------
- X * 242 100.0 %
- X *
- X * When there is an access path leading to the final operand (e.g. a record
- X * component), only the final data type on the access path is counted.
- X *
- X *
- X * 4. Operand Locality:
- X * -------------------
- X * number approximate
- X * percentage
- X *
- X * local variable 114 47.1 %
- X * global variable 22 9.1 %
- X * parameter 45 18.6 %
- X * value 23 9.5 %
- X * reference 22 9.1 %
- X * function result 6 2.5 %
- X * constant 55 22.7 %
- X * --- -------
- X * 242 100.0 %
- X *
- X *
- X * The program does not compute anything meaningful, but it is syntactically
- X * and semantically correct. All variables have a value assigned to them
- X * before they are used as a source operand.
- X *
- X * There has been no explicit effort to account for the effects of a
- X * cache, or to balance the use of long or short displacements for code or
- X * data.
- X *
- X ***************************************************************************
- X */
- X
- X
- X/* Compiler and system dependent definitions: */
- X
- X#ifndef TIME
- X#define TIMES
- X#endif
- X /* Use times(2) time function unless */
- X /* explicitly defined otherwise */
- X
- X#ifdef TIMES
- X#include <sys/types.h>
- X#include <sys/times.h>
- X /* for "times" */
- X#endif
- X
- X#define Mic_secs_Per_Second 1000000.0
- X /* Berkeley UNIX C returns process times in seconds/HZ */
- X
- X#ifdef NOSTRUCTASSIGN
- X#define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
- X#else
- X#define structassign(d, s) d = s
- X#endif
- X
- X#ifdef NOENUM
- X#define Ident_1 0
- X#define Ident_2 1
- X#define Ident_3 2
- X#define Ident_4 3
- X#define Ident_5 4
- X typedef int Enumeration;
- X#else
- X typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
- X Enumeration;
- X#endif
- X /* for boolean and enumeration types in Ada, Pascal */
- X
- X/* General definitions: */
- X
- X#include <stdio.h>
- X /* for strcpy, strcmp */
- X
- X#define Null 0
- X /* Value of a Null pointer */
- X#define true 1
- X#define false 0
- X
- 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];
- X
- typedef struct record
- X {
- X struct record *Ptr_Comp;
- X Enumeration Discr;
- X union {
- X struct {
- X Enumeration Enum_Comp;
- X int Int_Comp;
- X char Str_Comp [31];
- X } var_1;
- X struct {
- X Enumeration E_Comp_2;
- X char Str_2_Comp [31];
- X } var_2;
- X struct {
- X char Ch_1_Comp;
- X char Ch_2_Comp;
- X } var_3;
- X } variant;
- X } Rec_Type, *Rec_Pointer;
- X
- END_OF_FILE
- if test 18918 -ne `wc -c <'src/dhry.h'`; then
- echo shar: \"'src/dhry.h'\" unpacked with wrong size!
- fi
- chmod +x 'src/dhry.h'
- # end of 'src/dhry.h'
- fi
- echo shar: End of archive 4 \(of 4\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-