home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c220 / 4.ddi / DEMOS / DRY.C < prev    next >
Encoding:
Text File  |  1990-12-16  |  21.1 KB  |  652 lines

  1. /* Modified to access MS-DOS time function as provided by High C. */
  2. /*
  3.  *    "DHRYSTONE" Benchmark Program
  4.  *
  5.  *    Version:    C/1, 12/01/84
  6.  *
  7.  *    Date:        PROGRAM updated 11/02/85, RESULTS updated 12/13/85
  8.  *
  9.  *    Author:        Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013
  10.  *            Translated from ADA by Rick Richardson
  11.  *            Every method to preserve ADA-likeness has been used,
  12.  *            at the expense of C-ness.
  13.  *
  14.  *    Compile:    cc -O dry.c -o drynr            : No registers
  15.  *            cc -O -DREG=register dry.c -o dryr    : Registers
  16.  *
  17.  *    Defines:    Defines are provided for old C compiler's
  18.  *            which don't have enums, and can't assign structures.
  19.  *            The time(2) function is library dependant; Most
  20.  *            return the time in seconds, but beware of some, like
  21.  *            Aztec C, which return other units.
  22.  *            The LOOPS define is initially set for 50000 loops.
  23.  *            If you have a machine with large integers and is
  24.  *            very fast, please change this number to 500000 to
  25.  *            get better accuracy.  Please select the way to
  26.  *            measure the execution time using the TIME define.
  27.  *            For single user machines, time(2) is adequate. For
  28.  *            multi-user machines where you cannot get single-user
  29.  *            access, use the times(2) function.  If you have
  30.  *            neither, use a stopwatch in the dead of night.
  31.  *            Use a "printf" at the point marked "start timer"
  32.  *            to begin your timings. DO NOT use the UNIX "time(1)"
  33.  *            command, as this will measure the total time to
  34.  *            run this program, which will (erroneously) include
  35.  *            the time to malloc(3) storage and to compute the
  36.  *            time it takes to do nothing.
  37.  *
  38.  *    Run:        drynr; dryr
  39.  *
  40.  *    Results:    If you get any new machine/OS results, please send to:
  41.  *
  42.  *                {ihnp4,vax135,..}!houxm!castor!pcrat!rer
  43.  *
  44.  *            and thanks to all that do.  Space prevents listing
  45.  *            the names of those who have provided some of these
  46.  *            results.
  47.  *
  48.  *    Note:        I order the list in increasing performance of the
  49.  *            "with registers" benchmark.  If the compiler doesn't
  50.  *            provide register variables, then the benchmark
  51.  *            is the same for both REG and NOREG.  I'm not going
  52.  *            to list a compiler in a better place because if it
  53.  *            had register variables it might do better. No
  54.  *            register variables is a big loss in my book.
  55.  *
  56.  *    PLEASE:        Send complete information about the machine type,
  57.  *            clock speed, OS and C manufacturer/version.  If
  58.  *            the machine is modified, tell me what was done.
  59.  *            On UNIX, execute uname -a and cc -V to get this info.
  60.  *
  61.  *    80x8x NOTE:    80x8x benchers: please try to do all memory models
  62.  *            for a particular compiler.
  63.  *
  64.  *--------------------------------RESULTS BEGIN--------------------------------
  65.  *
  66.  * MACHINE    MICROPROCESSOR    OPERATING    COMPILER    DHRYSTONES/SEC.
  67.  * TYPE                SYSTEM                NO REG    REGS
  68.  * --------------------------    ------------    -----------    ---------------
  69.  * Commodore 64    6510-1MHz    C64 ROM        C Power 2.8      36      36
  70.  * HP-110    8086-5.33Mhz    MSDOS 2.11    Lattice 2.14     284     284
  71.  * IBM PC/XT    8088-4.77Mhz    PC/IX        cc         257     287
  72.  * P-E 3205    ?        Xelos(SVR2)     cc         279     296
  73.  * Perq-II    2901 bitslice    Accent S5c     cc (CMU)     301     301
  74.  * IBM PC/XT    8088-4.77Mhz    COHERENT 2.3.43    MarkWilliams cc  296     317
  75.  * Cosmos    68000-8Mhz    UniSoft        cc         305     322
  76.  * IBM PC/XT    8088-4.77Mhz    Venix/86 2.0    cc         297     324
  77.  * DEC PRO 350  11/23           Venix/PRO SVR2  cc               299     325
  78.  * PC/XT        8088-4.77Mhz    Venix/86 SYS V  cc               339     377
  79.  * IBM PC    8088-4.77Mhz    MSDOS 2.0    b16cc 2.0     310     340
  80.  * Commodore Amiga        ?        Lattice 3.02     368     371
  81.  * IBM PC    8088-4.77Mhz    MSDOS 2.0    CI-C86 2.20M     390     390
  82.  * IBM PC/XT    8088-4.77Mhz    PCDOS 2.1    Wizard 2.1     367     403
  83.  * IBM PC/XT    8088-4.77Mhz    PCDOS 3.1    Lattice 2.15     403     403 @
  84.  * IBM PC    8088-4.77Mhz    PCDOS 3.1    Datalight 1.10     416     416
  85.  * IBM PC/XT    8088-4.77Mhz    PCDOS 2.1    Microsoft 3.0     390     427
  86.  * PDP-11/34    -        UNIX V7M    cc         387     438
  87.  * IBM PC    8088, 4.77mhz    PC-DOS 2.1    Aztec C v3.2d     423     454
  88.  * Tandy 1000    V20, 4.77mhz    MS-DOS 2.11    Aztec C v3.2d     423     458
  89.  * PDP-11/34    -        RSTS/E        decus c         438     495
  90.  * Onyx C8002    Z8000-4Mhz    IS/1 1.1 (V7)    cc         476     511
  91.  * Perkin-Elmer 3230        Xelos (SysV.2)    cc         507     565
  92.  * DEC PRO 380  11/73           Venix/PRO SVR2  cc               577     628
  93.  * FHL QT+    68000-10Mhz    Os9/68000    version 1.3     603     649 FH
  94.  * Apollo DN550    68010-?Mhz    AegisSR9/IX    cc 3.12         666     666
  95.  * HP-110    8086-5.33Mhz    MSDOS 2.11    Aztec-C         641     676 
  96.  * ATT PC6300    8086-8Mhz    MSDOS 2.11    b16cc 2.0     632     684
  97.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    CI-C86 2.1     666     684
  98.  * Tandy 6000    68000-8Mhz    Xenix 3.0    cc         694     694
  99.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         684     704 MM
  100.  * Macintosh    68000-7.8Mhz 2M    Mac Rom        Mac C 32 bit int 694     704
  101.  * Macintosh    68000-7.7Mhz    -        MegaMax C 2.0     661     709
  102.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         704     714 LM
  103.  * Codata 3300    68000-8Mhz    UniPlus+ (v7)    cc         678     725
  104.  * Cadmus 9000    68010-10Mhz    UNIX        cc         714     735
  105.  * AT&T 6300    8086-8Mhz       Venix/86 SVR2   cc               668     743
  106.  * Cadmus 9790    68010-10Mhz 1MB    SVR0,Cadmus3.7    cc         720     747
  107.  * NEC PC9801F    8086-8Mhz    PCDOS 2.11    Lattice 2.15     768      -  @
  108.  * ATT PC6300    8086-8Mhz    MSDOS 2.11    CI-C86 2.20M     769     769
  109.  * Burroughs XE550 68010-10Mhz    Centix 2.10    cc         769     769 CT1
  110.  * EAGLE/TURBO  8086-8Mhz       Venix/86 SVR2   cc               696     779
  111.  * ALTOS 586    8086-10Mhz    Xenix 3.0b    cc          724     793
  112.  * DEC 11/73    J-11 micro    Ultrix-11 V3.0    System V     735     793
  113.  * ATT 3B2/300    WE32000-?Mhz    UNIX 5.0.2    cc         735     806
  114.  * Apollo DN320    68010-?Mhz    AegisSR9/IX    cc 3.12         806     806
  115.  * IRIS-2400    68010-10Mhz    UNIX System V    cc         772     829
  116.  * Atari 520ST  68000-8Mhz      TOS             DigResearch      839     846
  117.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    MS 3.0(large)     833     847 LM
  118.  * VAX 11/750    -        Ultrix 1.1    4.2BSD cc     781     862
  119.  * P-E  7350A    68000-8MHz    UniSoft V.2    cc         821     875
  120.  * VAX 11/750    -        UNIX 4.2bsd    cc         862     877
  121.  * Fast Mac    68000-7.7Mhz    -        MegaMax C 2.0     839     904 +
  122.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Microsoft 3.0     833     909 C1
  123.  * DEC 11/44            Ultrix-11 V3.0    System V     862     909
  124.  * Macintosh    68000-7.8Mhz 2M    Mac Rom        Mac C 16 bit int 877     909 S
  125.  * P-E 3210    ?        Xelos R01(SVR2)    cc         849     924
  126.  * P-E 3220    ?               Ed. 7 v2.3      cc         892     925
  127.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc -i         909     925
  128.  * AT&T 6300    8086, 8mhz    MS-DOS 2.11    Aztec C v3.2d     862     943
  129.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         892     961
  130.  * VAX 11/750    w/FPA        Eunice 3.2    cc         914     976
  131.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Wizard 2.1     892     980 C1
  132.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Lattice 2.15     980     980 C1
  133.  * Plexus P35    68000-10Mhz    UNIX System III cc         984     980
  134.  * PDP-11/73    KDJ11-AA 15Mhz    UNIX V7M 2.1    cc         862     981
  135.  * VAX 11/750    w/FPA        UNIX 4.3bsd    cc         994     997
  136.  * IRIS-1400    68010-10Mhz    UNIX System V    cc         909    1000
  137.  * IBM PC/AT    80286-6Mhz    Venix/86 2.1    cc         961    1000
  138.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    b16cc 2.0     943    1063
  139.  * Zilog S8000/11 Z8001-5.5Mhz    Zeus 3.2    cc        1011    1084
  140.  * NSC ICM-3216 NSC 32016-10Mhz    UNIX SVR2    cc        1041    1084
  141.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    MS 3.0(small)    1063    1086
  142.  * VAX 11/750    w/FPA        VMS        VAX-11 C 2.0     958    1091
  143.  * Stride    68000-10Mhz    System-V/68    cc        1041    1111
  144.  * ATT PC7300    68010-10Mhz    UNIX 5.2    cc        1041    1111
  145.  * P-E 3230    ?        Xelos R01(SVR2)    cc        1040    1126
  146.  * Stride    68000-12Mhz    System-V/68    cc        1063    1136
  147.  * IBM PC/AT    80286-6Mhz      Venix/286 SVR2  cc              1056    1149
  148.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    Datalight 1.10    1190    1190
  149.  * ATT PC6300+    80286-6Mhz    MSDOS 3.1    b16cc 2.0    1111    1219
  150.  * IBM PC/AT    80286-6Mhz    PCDOS 3.1    Wizard 2.1    1136    1219
  151.  * Sun2/120    68010-10Mhz    Sun 4.2BSD    cc        1136    1219
  152.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    CI-C86 2.20M    1219    1219
  153.  * MASSCOMP 500    68010-10MHz    RTU V3.0    cc (V3.2)    1156    1238
  154.  * Cyb DataMate    68010-12.5Mhz    Uniplus 5.0    Unisoft cc    1162    1250
  155.  * PDP 11/70    -        UNIX 5.2    cc        1162    1250
  156.  * IBM PC/AT    80286-6Mhz    PCDOS 3.1    Lattice 2.15    1250    1250
  157.  * IBM PC/AT    80286-7.5Mhz    Venix/86 2.1    cc        1190    1315 *15
  158.  * Sun2/120    68010-10Mhz    Standalone    cc        1219    1315
  159.  * Intel 380    80286-8Mhz    Xenix R3.0up1    cc        1250    1315 *16
  160.  * ATT 3B2/400    WE32100-?Mhz    UNIX 5.2    cc        1315    1315
  161.  * P-E 3250XP    -        Xelos R01(SVR2)    cc        1215    1318
  162.  * DG MV4000    -        AOS/VS 5.00    cc        1333    1333
  163.  * IBM PC/AT    80286-8Mhz    Venix/86 2.1    cc        1275    1380 *16
  164.  * IBM PC/AT    80286-6Mhz    MSDOS 3.0    Microsoft 3.0    1250    1388
  165.  * ATT PC6300+    80286-6Mhz    MSDOS 3.1    CI-C86 2.20M    1428    1428
  166.  * COMPAQ/286   80286-8Mhz      Venix/286 SVR2  cc              1326    1443
  167.  * IBM PC/AT    80286-7.5Mhz    Venix/286 SVR2  cc              1333    1449 *15
  168.  * Cyb DataMate    68010-12.5Mhz    Uniplus 5.0    Unisoft cc    1470    1562 S
  169.  * VAX 11/780    -        UNIX 5.2    cc        1515    1562
  170.  * MicroVAX-II    -        -        -        1562    1612
  171.  * VAX 11/780    -        UNIX 4.3bsd    cc        1646    1662
  172.  * Apollo DN660    -        AegisSR9/IX    cc 3.12        1666    1666
  173.  * ATT 3B20    -        UNIX 5.2    cc        1515    1724
  174.  * NEC PC-98XA    80286-8Mhz    PCDOS 3.1    Lattice 2.15    1724    1724 @
  175.  * HP9000-500    B series CPU    HP-UX 4.02    cc        1724    -
  176.  * IBM PC/STD    80286-8Mhz    MSDOS 3.0     Microsoft 3.0    1724    1785 C2
  177.  * DEC-2065    KL10-Model B    TOPS-20 6.1FT5    Port. C Comp.    1937    1946
  178.  * Gould PN6005    -        UTX 1.1(4.2BSD)    cc        1675    1964
  179.  * DEC2060    KL-10        TOPS-20        cc        2000    2000 &
  180.  * VAX 11/785    -        UNIX 5.2    cc        2083    2083
  181.  * VAX 11/785    -        VMS        VAX-11 C 2.0    2083    2083
  182.  * VAX 11/785    -        UNIX SVR2    cc        2123    2083
  183.  * VAX 11/785    -        UNIX 4.3bsd    cc        2135    2136
  184.  * Pyramid 90x    -        OSx 2.3        cc        2272    2272
  185.  * Pyramid 90x    FPA,cache,4Mb    OSx 2.5        cc no -O    2777    2777
  186.  * Alliant FX-8 CE        ?        ?        2622    2901 FX
  187.  * Pyramid 90x    w/cache        OSx 2.5        cc w/-O        3333    3333
  188.  * IBM-4341-II    -        VM/SP3        Waterloo C 1.2  3333    3333
  189.  * IRIS-2400T    68020-16.67Mhz    UNIX System V    cc        3105    3401
  190.  * SUN 3/75    68020-16.67Mhz    SUN 4.2 V3    cc        3333    3571
  191.  * IBM-4341    Model 12    UTS 5.0        ?        3685    3685
  192.  * SUN-3/160    68020-16.67Mhz  Sun 4.2 V3.0A   cc        3381    3764
  193.  * Sun 3/180    68020-16.67Mhz    Sun 4.2        cc        3333    3846
  194.  * IBM-4341    Model 12    UTS 5.0        ?        3910    3910 MN
  195.  * MC 5400    68020-16.67MHz    RTU V3.0    cc (V4.0)    3952    4054
  196.  * NCR Tower32  68020-16.67Mhz  SYS 5.0 Rel 2.0 cc              3846    4545
  197.  * Gould PN9080    -        UTX-32 1.1c    cc        -    4629
  198.  * MC 5600/5700    68020-16.67MHz    RTU V3.0    cc (V4.0)    4504    4746 %
  199.  * Gould 1460-342 ECL proc      UTX/32 1.1/c    cc              5342    5677 G1
  200.  * VAX 8600    -        UNIX 4.3bsd    cc        7024    7088
  201.  * VAX 8600    -        VMS        VAX-11 C 2.0    7142    7142
  202.  * CCI POWER 6/32        COS(SV+4.2)    cc        7500    7800
  203.  * CCI POWER 6/32        POWER 6 UNIX/V    cc        8236    8498
  204.  * CCI POWER 6/32        4.2 Rel. 1.2b    cc        8963    9544
  205.  * Sperry (CCI Power 6)        4.2BSD        cc        9345   10000
  206.  * CRAY-X-MP/12       105Mhz    COS 1.14    Cray C         10204   10204
  207.  * IBM-3083    -        UTS 5.0 Rel 1    cc           16666   12500
  208.  * CRAY-1A        80Mhz    CTSS        Cray C 2.0     12100   13888
  209.  * IBM-3083    -        VM/CMS HPO 3.4    Waterloo C 1.2 13889   13889
  210.  * Amdahl 470 V/8         UTS/V 5.2       cc v1.23       15560   15560
  211.  * CRAY-X-MP/48       105Mhz    CTSS        Cray C 2.0     15625   17857
  212.  * Amdahl 580    -        UTS 5.0 Rel 1.2    cc v1.5        23076   23076
  213.  * Amdahl 5860             UTS/V 5.2       cc v1.23       28970   28970
  214.  *
  215.  *   *   Crystal changed from 'stock' to listed value.
  216.  *   +   This Macintosh was upgraded from 128K to 512K in such a way that
  217.  *       the new 384K of memory is not slowed down by video generator accesses.
  218.  *   %   Single processor; MC == MASSCOMP
  219.  *   &   A version 7 C compiler written at New Mexico Tech.
  220.  *   @   vanilla Lattice compiler used with MicroPro standard library
  221.  *   S   Shorts used instead of ints
  222.  *   LM  Large Memory Model. (Otherwise, all 80x8x results are small model)
  223.  *   MM  Medium Memory Model. (Otherwise, all 80x8x results are small model)
  224.  *   C1  Univation PC TURBO Co-processor; 9.54Mhz 8086, 640K RAM
  225.  *   C2  Seattle Telecom STD-286 board
  226.  *   C?  Unknown co-processor board?
  227.  *   CT1 Convergent Technologies MegaFrame, 1 processor.
  228.  *   MN  Using Mike Newtons 'optimizer' (see net.sources).
  229.  *   G1  This Gould machine has 2 processors and was able to run 2 dhrystone
  230.  *       Benchmarks in parallel with no slowdown.
  231.  *   FH  FHC == Frank Hogg Labs (Hazelwood Uniquad 2 in an FHL box).
  232.  *   FX  The FX-8 has two kinds of processors.  This figure is for CE's
  233.  *     (computation engines).  The other processor type is an IP (interactive
  234.  *     processor) which is a 68010-12Mhz. Figures were not precisely
  235.  *     determined for the IP.
  236.  *   ?   I don't trust results marked with '?'.  These were sent to me with
  237.  *       either incomplete info, or with times that just don't make sense.
  238.  *     ?? means I think the performance is too poor, ?! means too good.
  239.  *       If anybody can confirm these figures, please respond.
  240.  *
  241.  *--------------------------------RESULTS END----------------------------------
  242.  *
  243.  *    The following program contains statements of a high-level programming
  244.  *    language (C) in a distribution considered representative:
  245.  *
  246.  *    assignments            53%
  247.  *    control statements        32%
  248.  *    procedure, function calls    15%
  249.  *
  250.  *    100 statements are dynamically executed.  The program is balanced with
  251.  *    respect to the three aspects:
  252.  *        - statement type
  253.  *        - operand type (for simple data types)
  254.  *        - operand access
  255.  *            operand global, local, parameter, or constant.
  256.  *
  257.  *    The combination of these three aspects is balanced only approximately.
  258.  *
  259.  *    The program does not compute anything meaningfull, but it is
  260.  *    syntactically and semantically correct.
  261.  *
  262.  */
  263.  
  264. /* Accuracy of timings and human fatigue controlled by next two lines */
  265. #define LOOPS  200000        /* Use this for slow or 16 bit machines */
  266. /*#define LOOPS    50000        /* Use this for faster machines */
  267.  
  268. /* Compiler dependent options */
  269. #undef    NOENUM            /* Define if compiler has no enum's */
  270. #undef    NOSTRUCTASSIGN        /* Define if compiler can't assign structures */
  271. /* define only one of the next two defines */
  272. /* Use TIME and HZ =100 for UNIX. */
  273. /*#define TIMES        /* Use times(2) time function */
  274. /* #define TIME            /* Use time(2) time function */
  275. #define HCTIME            /* Use time interface for MS-DOS provided by High C */
  276. #ifdef HCTIME
  277. #include <system.cf>    /* MS-DOS system interface */
  278. #endif
  279.  
  280. /* define the granularity of your times(2) function (when used) */
  281. /*#define HZ    60        /* times(2) returns 1/60 second (most) */
  282. /* Use 100 for system 5 and ms-dos. */
  283. #define HZ    100        /* times(2) returns 1/100 second (WECo) */
  284.  
  285. #ifdef GOOF
  286. char    Version[] = "1.0";
  287. #else
  288. char    Version[] = "1.1";
  289. #endif
  290.  
  291.  
  292.  
  293. #ifdef    NOSTRUCTASSIGN
  294. #define    structassign(d, s)    memcpy(&(d), &(s), sizeof(d))
  295. #else
  296. #define    structassign(d, s)    d = s
  297. #endif
  298.  
  299. #ifdef    NOENUM
  300. #define    Ident1    1
  301. #define    Ident2    2
  302. #define    Ident3    3
  303. #define    Ident4    4
  304. #define    Ident5    5
  305. typedef int    Enumeration;
  306. #else
  307. typedef enum    {Ident1, Ident2, Ident3, Ident4, Ident5} Enumeration;
  308. #endif
  309.  
  310. typedef int    OneToThirty;
  311. typedef int    OneToFifty;
  312. typedef char    CapitalLetter;
  313. typedef char    String30[31];
  314. typedef int    Array1Dim[51];
  315. typedef int    Array2Dim[51][51];
  316.  
  317. struct    Record
  318. {
  319.     struct Record        *PtrComp;
  320.     Enumeration        Discr;
  321.     Enumeration        EnumComp;
  322.     OneToFifty        IntComp;
  323.     String30        StringComp;
  324. };
  325.  
  326. typedef struct Record     RecordType;
  327. typedef RecordType *    RecordPtr;
  328. typedef int        boolean;
  329.  
  330. #define    NULL        0
  331. #define    TRUE        1
  332. #define    FALSE        0
  333.  
  334. #ifndef REG
  335. #define    REG
  336. #endif
  337.  
  338. extern Enumeration    Func1();
  339. extern boolean        Func2();
  340.  
  341.  
  342. #ifdef DB
  343. #define debugf(s) printf(s)
  344. #else
  345. #define debugf(s)
  346. #endif
  347.  
  348. main()
  349. {
  350.     Proc0();
  351.     exit(0);
  352. }
  353.  
  354. /*
  355.  * Package 1
  356.  */
  357. int        IntGlob;
  358. boolean        BoolGlob;
  359. char        Char1Glob;
  360. char        Char2Glob;
  361. Array1Dim    Array1Glob;
  362. Array2Dim    Array2Glob;
  363. RecordPtr    PtrGlb;
  364. RecordPtr    PtrGlbNext;
  365.  
  366. Proc0()
  367. {
  368.     OneToFifty        IntLoc1;
  369.     REG OneToFifty        IntLoc2;
  370.     OneToFifty        IntLoc3;
  371.     REG char        CharLoc;
  372.     REG char        CharIndex;
  373.     Enumeration         EnumLoc;
  374.     String30        String1Loc;
  375.     String30        String2Loc;
  376.     extern char        *malloc();
  377.     register unsigned int    i;
  378.  
  379. #ifdef TIME
  380.     long            time();
  381.     long            starttime;
  382.     long            benchtime;
  383.     long            nulltime;
  384.  
  385.     starttime = time( (long *) 0);
  386.     for (i = 0; i < LOOPS; ++i);
  387.     nulltime = time( (long *) 0) - starttime; /* Computes o'head of loop */
  388. #endif
  389. #ifdef HCTIME
  390.     typedef long time_t;
  391.     time_t            starttime;
  392.     time_t            benchtime;
  393.     time_t            nulltime;
  394.         starttime = clock();
  395.     for (i = 0; i < LOOPS; ++i);
  396.     nulltime = clock() - starttime; /* Computes overhead of looping */
  397. #endif
  398.  
  399.     PtrGlbNext = (RecordPtr) malloc(sizeof(RecordType));
  400.     PtrGlb = (RecordPtr) malloc(sizeof(RecordType));
  401.     PtrGlb->PtrComp = PtrGlbNext;
  402.     PtrGlb->Discr = Ident1;
  403.     PtrGlb->EnumComp = Ident3;
  404.     PtrGlb->IntComp = 40;
  405.     strcpy(PtrGlb->StringComp, "DHRYSTONE PROGRAM, SOME STRING");
  406. #ifndef    GOOF
  407.     strcpy(String1Loc, "DHRYSTONE PROGRAM, 1'ST STRING");    /*GOOF*/
  408. #endif
  409.     Array2Glob[8][7] = 10;    /* Was missing in published program */
  410.  
  411. /*****************
  412. -- Start Timer --
  413. *****************/
  414. #ifdef TIME
  415.     starttime = time( (long *) 0);
  416. #endif
  417. #ifdef HCTIME
  418.     starttime = clock();
  419. #endif    
  420.     for (i = 0; i < LOOPS; ++i)
  421.     {
  422.  
  423.         Proc5();
  424.         Proc4();
  425.         IntLoc1 = 2;
  426.         IntLoc2 = 3;
  427.         strcpy(String2Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
  428.         EnumLoc = Ident2;
  429.         BoolGlob = ! Func2(String1Loc, String2Loc);
  430.         while (IntLoc1 < IntLoc2)
  431.         {
  432.             IntLoc3 = 5 * IntLoc1 - IntLoc2;
  433.             Proc7(IntLoc1, IntLoc2, &IntLoc3);
  434.             ++IntLoc1;
  435.         }
  436.         Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3);
  437.         Proc1(PtrGlb);
  438.         for (CharIndex = 'A'; CharIndex <= Char2Glob; ++CharIndex)
  439.             if (EnumLoc == Func1(CharIndex, 'C'))
  440.                 Proc6(Ident1, &EnumLoc);
  441.         IntLoc3 = IntLoc2 * IntLoc1;
  442.         IntLoc2 = IntLoc3 / IntLoc1;
  443.         IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1;
  444.         Proc2(&IntLoc1);
  445.     }
  446.  
  447. /*****************
  448. -- Stop Timer --
  449. *****************/
  450.  
  451. #ifdef TIME
  452.     benchtime = time( (long *) 0) - starttime - nulltime;
  453.     printf("Dhrystone time for %ld passes = %ld\n",
  454.         (long) LOOPS, benchtime);
  455.     printf("This machine benchmarks at %ld dhrystones/second\n",
  456.         ((long) LOOPS) / benchtime);
  457. #endif
  458. #ifdef HCTIME
  459.     benchtime = clock() - starttime - nulltime;
  460.     printf("Dhrystone time for %ld passes = %ld\n",
  461.         (long) LOOPS, benchtime/HZ);
  462.     printf("This machine benchmarks at %ld dhrystones/second\n",
  463.         ((long) LOOPS) * HZ / benchtime);
  464. #endif
  465.  
  466. }
  467.  
  468. Proc1(PtrParIn)
  469. REG RecordPtr    PtrParIn;
  470. {
  471. #define    NextRecord    (*(PtrParIn->PtrComp))
  472.  
  473.     structassign(NextRecord, *PtrGlb);
  474.     PtrParIn->IntComp = 5;
  475.     NextRecord.IntComp = PtrParIn->IntComp;
  476.     NextRecord.PtrComp = PtrParIn->PtrComp;
  477.     Proc3(NextRecord.PtrComp);
  478.     if (NextRecord.Discr == Ident1)
  479.     {
  480.         NextRecord.IntComp = 6;
  481.         Proc6(PtrParIn->EnumComp, &NextRecord.EnumComp);
  482.         NextRecord.PtrComp = PtrGlb->PtrComp;
  483.         Proc7(NextRecord.IntComp, 10, &NextRecord.IntComp);
  484.     }
  485.     else
  486.         structassign(*PtrParIn, NextRecord);
  487.  
  488. #undef    NextRecord
  489. }
  490.  
  491. Proc2(IntParIO)
  492. OneToFifty    *IntParIO;
  493. {
  494.     REG OneToFifty        IntLoc;
  495.     REG Enumeration        EnumLoc;
  496.  
  497.     IntLoc = *IntParIO + 10;
  498.     for(;;)
  499.     {
  500.         if (Char1Glob == 'A')
  501.         {
  502.             --IntLoc;
  503.             *IntParIO = IntLoc - IntGlob;
  504.             EnumLoc = Ident1;
  505.         }
  506.         if (EnumLoc == Ident1)
  507.             break;
  508.     }
  509. }
  510.  
  511. Proc3(PtrParOut)
  512. RecordPtr    *PtrParOut;
  513. {
  514.     if (PtrGlb != NULL)
  515.         *PtrParOut = PtrGlb->PtrComp;
  516.     else
  517.         IntGlob = 100;
  518.     Proc7(10, IntGlob, &PtrGlb->IntComp);
  519. }
  520.  
  521. Proc4()
  522. {
  523.     REG boolean    BoolLoc;
  524.  
  525.     BoolLoc = Char1Glob == 'A';
  526.     BoolLoc |= BoolGlob;
  527.     Char2Glob = 'B';
  528. }
  529.  
  530. Proc5()
  531. {
  532.     Char1Glob = 'A';
  533.     BoolGlob = FALSE;
  534. }
  535.  
  536. extern boolean Func3();
  537.  
  538. Proc6(EnumParIn, EnumParOut)
  539. REG Enumeration    EnumParIn;
  540. REG Enumeration    *EnumParOut;
  541. {
  542.     *EnumParOut = EnumParIn;
  543.     if (! Func3(EnumParIn) )
  544.         *EnumParOut = Ident4;
  545.     switch (EnumParIn)
  546.     {
  547.     case Ident1:    *EnumParOut = Ident1; break;
  548.     case Ident2:    if (IntGlob > 100) *EnumParOut = Ident1;
  549.             else *EnumParOut = Ident4;
  550.             break;
  551.     case Ident3:    *EnumParOut = Ident2; break;
  552.     case Ident4:    break;
  553.     case Ident5:    *EnumParOut = Ident3;
  554.     }
  555. }
  556.  
  557. Proc7(IntParI1, IntParI2, IntParOut)
  558. OneToFifty    IntParI1;
  559. OneToFifty    IntParI2;
  560. OneToFifty    *IntParOut;
  561. {
  562.     REG OneToFifty    IntLoc;
  563.  
  564.     IntLoc = IntParI1 + 2;
  565.     *IntParOut = IntParI2 + IntLoc;
  566. }
  567.  
  568. Proc8(Array1Par, Array2Par, IntParI1, IntParI2)
  569. Array1Dim    Array1Par;
  570. Array2Dim    Array2Par;
  571. OneToFifty    IntParI1;
  572. OneToFifty    IntParI2;
  573. {
  574.     REG OneToFifty    IntLoc;
  575.     REG OneToFifty    IntIndex;
  576.  
  577.     IntLoc = IntParI1 + 5;
  578.     Array1Par[IntLoc] = IntParI2;
  579.     Array1Par[IntLoc+1] = Array1Par[IntLoc];
  580.     Array1Par[IntLoc+30] = IntLoc;
  581.     for (IntIndex = IntLoc; IntIndex <= (IntLoc+1); ++IntIndex)
  582.         Array2Par[IntLoc][IntIndex] = IntLoc;
  583.     ++Array2Par[IntLoc][IntLoc-1];
  584.     Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc];
  585.     IntGlob = 5;
  586. }
  587.  
  588. Enumeration Func1(CharPar1, CharPar2)
  589. CapitalLetter    CharPar1;
  590. CapitalLetter    CharPar2;
  591. {
  592.     REG CapitalLetter    CharLoc1;
  593.     REG CapitalLetter    CharLoc2;
  594.  
  595.     CharLoc1 = CharPar1;
  596.     CharLoc2 = CharLoc1;
  597.     if (CharLoc2 != CharPar2)
  598.         return (Ident1);
  599.     else
  600.         return (Ident2);
  601. }
  602.  
  603. boolean Func2(StrParI1, StrParI2)
  604. String30    StrParI1;
  605. String30    StrParI2;
  606. {
  607.     REG OneToThirty        IntLoc;
  608.     REG CapitalLetter    CharLoc;
  609.  
  610.     IntLoc = 1;
  611.     while (IntLoc <= 1)
  612.         if (Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1)
  613.         {
  614.             CharLoc = 'A';
  615.             ++IntLoc;
  616.         }
  617.     if (CharLoc >= 'W' && CharLoc <= 'Z')
  618.         IntLoc = 7;
  619.     if (CharLoc == 'X')
  620.         return(TRUE);
  621.     else
  622.     {
  623.         if (strcmp(StrParI1, StrParI2) > 0)
  624.         {
  625.             IntLoc += 7;
  626.             return (TRUE);
  627.         }
  628.         else
  629.             return (FALSE);
  630.     }
  631. }
  632.  
  633. boolean Func3(EnumParIn)
  634. REG Enumeration    EnumParIn;
  635. {
  636.     REG Enumeration    EnumLoc;
  637.  
  638.     EnumLoc = EnumParIn;
  639.     if (EnumLoc == Ident3) return (TRUE);
  640.     return (FALSE);
  641. }
  642.  
  643. #ifdef    NOSTRUCTASSIGN
  644. memcpy(d, s, l)
  645. register char    *d;
  646. register char    *s;
  647. int    l;
  648. {
  649.     while (l--) *d++ = *s++;
  650. }
  651. #endif
  652.