home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best Objectech Shareware Selections
/
UNTITLED.iso
/
boss
/
util
/
misc
/
009
/
dhry.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-04-05
|
28KB
|
764 lines
{$A+,B-,D-,E+,F-,G-,I-,L-,N+,O-,R-,S-,V-,X-}
{$M 4096,0,655360}
UNIT Dhry;
INTERFACE
FUNCTION Dhrystones (Index: DOUBLE): DOUBLE;
IMPLEMENTATION
USES Time;
(*
****************************************************************************
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: Pascal, Version 2.1
*
* File: dhry.p
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
* Siemens AG, E STE 35
* Postfach 3220
* 8520 Erlangen
* Germany (West)
* Phone: [xxx-49]-9131-7-20330
* (8-17 Central European Time)
* Usenet: ..!mcvax!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,
*
* This version uses calls to the Pascal runtime library of the
* Berkeley UNIX system (4.3 bsd) for time measurement.
* For measurements on other systems, these calls need to be
* modified.
*
* Collection of Results:
* Reinhold Weicker (address see above) and
*
* Rick Richardson
* PC Research. Inc.
* 94 Apple Orchard Drive
* Tinton Falls, NJ 07724
* Phone: (201) 834-1378 (9-17 EST)
* Usenet: ...!seismo!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.
*
****************************************************************************
*
* History: This version Pascal/2.1 has been made for two reasons:
*
* 1) There is a need for a common Pascal version of
* Dhrystone. Although translation from the published (Ada)
* version to Pascal is straightforward in most aspects,
* there are cases where it may not be obvious to everyone.
* There should be, as far as possible, only one Pascal version
* of Dhrystone such that results can be compared without
* restrictions. Also, a Pascal version of Dhrystone has not yet
* found a network distribution comparable to the C version
* (version 1.1) distributed by Rick Richardson.
*
* 2) As far as it is possible without changes to the Dhrystone
* statistics, optimizing compilers should be prevented from
* removing significant statements.
*
* This Pascal version 2.1 has been made consistent with the
* C version 2.1; therefore the acknowledgments for the C version
* are due for the Pascal version as well: I thank
* Rick Richardson (Tinton Falls, NJ), Chaim Benedelac (Nat.
* Semi.), David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
* Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
* for their help with comments on earlier versions of the
* benchmark.
*
* Changes: In the initialization part, this version differs
* from the Pascal version previously distributed by Reinhold
* Weicker, the number of runs through Dhrystone is obtained
* interactively from the terminal. Output of the result
* has been changed to conform to the C version (2.1).
* The changes in the initialization part and in the printing
* of the result have no impact on performance measurement
* since they are outside the measaurement loop.
*
* Inside the measurement loop, this version follows the
* version previously distributed by Reinhold Weicker.
* As a correction to the published version, a statement
* initializing Array2Glob [8,7] (outside the measurement
* loop) has been added. Otherwise, this array element would
* have an undefined value.
*
* At several places in the benchmark, code has been added,
* but within the measurement loop only in branches that
* are not executed. The intention is that optimizing compilers
* should be prevented from moving code out of the measurement
* loop, or from removing code altogether. Since the statements
* that are executed within the measurement loop have NOT been
* changed, all numbers defining the "Dhrystone distribution"
* (distribution of statements, operand types and locality)
* still hold. Except for sophisticated optimizing compilers,
* execution times for this version should be the same as
* for previous versions.
*
* Since it has proven difficult to subtract the time for the
* measurement loop overhead in a correct way, the loop check
* has been made a part of the benchmark. This does have
* an impact - though a very minor one - on the distribution
* statistics which have been updated for this version.
*
* All changes within the measurement loop are described
* and discussed in the companion paper "Rationale for
* Dhrystone version 2".
*
* Because of the self-imposed limitation that the order and
* distribution of the executed statements should not be
* changed, there are still cases where optimizing compilers
* may not generate code for some statements. To a certain
* degree, this is unavoidable for small synthetic benchmarks.
* Users of the benchmark are advised to check code listings
* whether code is generated for all statements of Dhrystone.
*
* Version 2.1 is identical to version 2.0 distributed via
* the UNIX network Usenet in March 1988 except that it corrects
* some minor deficiencies that were found by users of version 2.0.
* The only change within the measurement loop is that a
* non-executed "else" part was added to the "if" statement in
* Func3, and a non-executed "else" part removed from Proc3.
*
***************************************************************************
*
* Compilation model and measurement (IMPORTANT):
*
* This program contains the Dhrystone program, including measurement setup,
* in one file. The original (Ada) program contained three packages,
* - a package with global type definitions,
* - Pack_1, containing the main program (Proc_0 in Ada) and procedures
* Proc_1, ... , Proc_5,
* - Pack_2, containing Proc_6, ... , Proc_8, Func_1, ..., Func_3.
* Since ISO/ANSI Standard Pascal provides no means to express separate
* compilation (although many Pascal implementations provide such a feature),
* it is not possible to formulate a portable Pascal version with the program
* in several