"DHRYSTONE" Benchmark Program * ----------------------------- * * Version: C, Version 2.1 * * File: dhry.h (part 1 of 3) * * Date: May 25, 1988 * * Author: Reinhold P. Weicker * Siemens Nixdorf Inf. Syst. * STM OS 32 * Otto-Hahn-Ring 6 * W-8000 Muenchen 83 * Germany
Dependents: Benchmark_Dhrystone
dhry.h@0:f7463045004e, 2017-01-06 (annotated)
- Committer:
- JovanEps
- Date:
- Fri Jan 06 16:08:09 2017 +0000
- Revision:
- 0:f7463045004e
Beta 0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JovanEps | 0:f7463045004e | 1 | /* |
JovanEps | 0:f7463045004e | 2 | ************************************************************************* |
JovanEps | 0:f7463045004e | 3 | * |
JovanEps | 0:f7463045004e | 4 | * "DHRYSTONE" Benchmark Program |
JovanEps | 0:f7463045004e | 5 | * ----------------------------- |
JovanEps | 0:f7463045004e | 6 | * |
JovanEps | 0:f7463045004e | 7 | * Version: C, Version 2.1 |
JovanEps | 0:f7463045004e | 8 | * |
JovanEps | 0:f7463045004e | 9 | * File: dhry.h (part 1 of 3) |
JovanEps | 0:f7463045004e | 10 | * |
JovanEps | 0:f7463045004e | 11 | * Date: May 25, 1988 |
JovanEps | 0:f7463045004e | 12 | * |
JovanEps | 0:f7463045004e | 13 | * Author: Reinhold P. Weicker |
JovanEps | 0:f7463045004e | 14 | * Siemens Nixdorf Inf. Syst. |
JovanEps | 0:f7463045004e | 15 | * STM OS 32 |
JovanEps | 0:f7463045004e | 16 | * Otto-Hahn-Ring 6 |
JovanEps | 0:f7463045004e | 17 | * W-8000 Muenchen 83 |
JovanEps | 0:f7463045004e | 18 | * Germany |
JovanEps | 0:f7463045004e | 19 | * Phone: [+49]-89-636-42436 |
JovanEps | 0:f7463045004e | 20 | * (8-17 Central European Time) |
JovanEps | 0:f7463045004e | 21 | * UUCP: weicker@ztivax.uucp@unido.uucp |
JovanEps | 0:f7463045004e | 22 | * Internet: weicker@ztivax.siemens.com |
JovanEps | 0:f7463045004e | 23 | * |
JovanEps | 0:f7463045004e | 24 | * Original Version (in Ada) published in |
JovanEps | 0:f7463045004e | 25 | * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), |
JovanEps | 0:f7463045004e | 26 | * pp. 1013 - 1030, together with the statistics |
JovanEps | 0:f7463045004e | 27 | * on which the distribution of statements etc. is based. |
JovanEps | 0:f7463045004e | 28 | * |
JovanEps | 0:f7463045004e | 29 | * In this C version, the following C library functions are |
JovanEps | 0:f7463045004e | 30 | * used: |
JovanEps | 0:f7463045004e | 31 | * - strcpy, strcmp (inside the measurement loop) |
JovanEps | 0:f7463045004e | 32 | * - printf, scanf (outside the measurement loop) |
JovanEps | 0:f7463045004e | 33 | * |
JovanEps | 0:f7463045004e | 34 | * Collection of Results: |
JovanEps | 0:f7463045004e | 35 | * Reinhold Weicker (address see above) and |
JovanEps | 0:f7463045004e | 36 | * |
JovanEps | 0:f7463045004e | 37 | * Rick Richardson |
JovanEps | 0:f7463045004e | 38 | * PC Research. Inc. |
JovanEps | 0:f7463045004e | 39 | * 94 Apple Orchard Drive |
JovanEps | 0:f7463045004e | 40 | * Tinton Falls, NJ 07724 |
JovanEps | 0:f7463045004e | 41 | * Phone: (201) 834-1378 (9-17 EST) |
JovanEps | 0:f7463045004e | 42 | * UUCP: ...!uunet!pcrat!rick |
JovanEps | 0:f7463045004e | 43 | * |
JovanEps | 0:f7463045004e | 44 | * Please send results to Rick Richardson and/or Reinhold Weicker. |
JovanEps | 0:f7463045004e | 45 | * Complete information should be given on hardware and software |
JovanEps | 0:f7463045004e | 46 | * used. Hardware information includes: Machine type, CPU, type and |
JovanEps | 0:f7463045004e | 47 | * size of caches; for microprocessors: clock frequency, memory speed |
JovanEps | 0:f7463045004e | 48 | * (number of wait states). Software information includes: Compiler |
JovanEps | 0:f7463045004e | 49 | * (and runtime library) manufacturer and version, compilation |
JovanEps | 0:f7463045004e | 50 | * switches, OS version. The Operating System version may give an |
JovanEps | 0:f7463045004e | 51 | * indication about the compiler; Dhrystone itself performs no OS |
JovanEps | 0:f7463045004e | 52 | * calls in the measurement loop. |
JovanEps | 0:f7463045004e | 53 | * |
JovanEps | 0:f7463045004e | 54 | * The complete output generated by the program should be mailed |
JovanEps | 0:f7463045004e | 55 | * such that at least some checks for correctness can be made. |
JovanEps | 0:f7463045004e | 56 | * |
JovanEps | 0:f7463045004e | 57 | ************************************************************************* |
JovanEps | 0:f7463045004e | 58 | * |
JovanEps | 0:f7463045004e | 59 | * History: This version C/2.1 has been made for two reasons: |
JovanEps | 0:f7463045004e | 60 | * |
JovanEps | 0:f7463045004e | 61 | * 1) There is an obvious need for a common C version of |
JovanEps | 0:f7463045004e | 62 | * Dhrystone, since C is at present the most popular system |
JovanEps | 0:f7463045004e | 63 | * programming language for the class of processors |
JovanEps | 0:f7463045004e | 64 | * (microcomputers, minicomputers) where Dhrystone is used |
JovanEps | 0:f7463045004e | 65 | * most. There should be, as far as possible, only one C |
JovanEps | 0:f7463045004e | 66 | * version of Dhrystone such that results can be compared |
JovanEps | 0:f7463045004e | 67 | * without restrictions. In the past, the C versions |
JovanEps | 0:f7463045004e | 68 | * distributed by Rick Richardson (Version 1.1) and by |
JovanEps | 0:f7463045004e | 69 | * Reinhold Weicker had small (though not significant) |
JovanEps | 0:f7463045004e | 70 | * differences. |
JovanEps | 0:f7463045004e | 71 | * |
JovanEps | 0:f7463045004e | 72 | * 2) As far as it is possible without changes to the |
JovanEps | 0:f7463045004e | 73 | * Dhrystone statistics, optimizing compilers should be |
JovanEps | 0:f7463045004e | 74 | * prevented from removing significant statements. |
JovanEps | 0:f7463045004e | 75 | * |
JovanEps | 0:f7463045004e | 76 | * This C version has been developed in cooperation with |
JovanEps | 0:f7463045004e | 77 | * Rick Richardson (Tinton Falls, NJ), it incorporates many |
JovanEps | 0:f7463045004e | 78 | * ideas from the "Version 1.1" distributed previously by |
JovanEps | 0:f7463045004e | 79 | * him over the UNIX network Usenet. |
JovanEps | 0:f7463045004e | 80 | * I also thank Chaim Benedelac (National Semiconductor), |
JovanEps | 0:f7463045004e | 81 | * David Ditzel (SUN), Earl Killian and John Mashey (MIPS), |
JovanEps | 0:f7463045004e | 82 | * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) |
JovanEps | 0:f7463045004e | 83 | * for their help with comments on earlier versions of the |
JovanEps | 0:f7463045004e | 84 | * benchmark. |
JovanEps | 0:f7463045004e | 85 | * |
JovanEps | 0:f7463045004e | 86 | * Changes: In the initialization part, this version follows mostly |
JovanEps | 0:f7463045004e | 87 | * Rick Richardson's version distributed via Usenet, not the |
JovanEps | 0:f7463045004e | 88 | * version distributed earlier via floppy disk by Reinhold |
JovanEps | 0:f7463045004e | 89 | * Weicker. As a concession to older compilers, names have |
JovanEps | 0:f7463045004e | 90 | * been made unique within the first 8 characters. Inside the |
JovanEps | 0:f7463045004e | 91 | * measurement loop, this version follows the version |
JovanEps | 0:f7463045004e | 92 | * previously distributed by Reinhold Weicker. |
JovanEps | 0:f7463045004e | 93 | * |
JovanEps | 0:f7463045004e | 94 | * At several places in the benchmark, code has been added, |
JovanEps | 0:f7463045004e | 95 | * but within the measurement loop only in branches that |
JovanEps | 0:f7463045004e | 96 | * are not executed. The intention is that optimizing |
JovanEps | 0:f7463045004e | 97 | * compilers should be prevented from moving code out of the |
JovanEps | 0:f7463045004e | 98 | * measurement loop, or from removing code altogether. Since |
JovanEps | 0:f7463045004e | 99 | * the statements that are executed within the measurement |
JovanEps | 0:f7463045004e | 100 | * loop have NOT been changed, the numbers defining the |
JovanEps | 0:f7463045004e | 101 | * "Dhrystone distribution" (distribution of statements, |
JovanEps | 0:f7463045004e | 102 | * operand types and locality) still hold. Except for |
JovanEps | 0:f7463045004e | 103 | * sophisticated optimizing compilers, execution times for |
JovanEps | 0:f7463045004e | 104 | * this version should be the same as for previous versions. |
JovanEps | 0:f7463045004e | 105 | * |
JovanEps | 0:f7463045004e | 106 | * Since it has proven difficult to subtract the time for the |
JovanEps | 0:f7463045004e | 107 | * measurement loop overhead in a correct way, the loop check |
JovanEps | 0:f7463045004e | 108 | * has been made a part of the benchmark. This does have |
JovanEps | 0:f7463045004e | 109 | * an impact - though a very minor one - on the distribution |
JovanEps | 0:f7463045004e | 110 | * statistics which have been updated for this version. |
JovanEps | 0:f7463045004e | 111 | * |
JovanEps | 0:f7463045004e | 112 | * All changes within the measurement loop are described |
JovanEps | 0:f7463045004e | 113 | * and discussed in the companion paper "Rationale for |
JovanEps | 0:f7463045004e | 114 | * Dhrystone version 2". |
JovanEps | 0:f7463045004e | 115 | * |
JovanEps | 0:f7463045004e | 116 | * Because of the self-imposed limitation that the order and |
JovanEps | 0:f7463045004e | 117 | * distribution of the executed statements should not be |
JovanEps | 0:f7463045004e | 118 | * changed, there are still cases where optimizing compilers |
JovanEps | 0:f7463045004e | 119 | * may not generate code for some statements. To a certain |
JovanEps | 0:f7463045004e | 120 | * degree, this is unavoidable for small synthetic |
JovanEps | 0:f7463045004e | 121 | * benchmarks. Users of the benchmark are advised to check |
JovanEps | 0:f7463045004e | 122 | * code listings whether code is generated for all statements |
JovanEps | 0:f7463045004e | 123 | * of Dhrystone. |
JovanEps | 0:f7463045004e | 124 | * |
JovanEps | 0:f7463045004e | 125 | * Version 2.1 is identical to version 2.0 distributed via |
JovanEps | 0:f7463045004e | 126 | * the UNIX network Usenet in March 1988 except that it |
JovanEps | 0:f7463045004e | 127 | * corrects some minor deficiencies that were found by users |
JovanEps | 0:f7463045004e | 128 | * of version 2.0. The only change within the measurement |
JovanEps | 0:f7463045004e | 129 | * loop is that a non-executed "else" part was added to the |
JovanEps | 0:f7463045004e | 130 | * "if" statement in Func_3, and a non-executed "else" part |
JovanEps | 0:f7463045004e | 131 | * removed from Proc_3. |
JovanEps | 0:f7463045004e | 132 | * |
JovanEps | 0:f7463045004e | 133 | ************************************************************************* |
JovanEps | 0:f7463045004e | 134 | * |
JovanEps | 0:f7463045004e | 135 | * Defines: The following "Defines" are possible: |
JovanEps | 0:f7463045004e | 136 | * -DROPT (default: Not defined) |
JovanEps | 0:f7463045004e | 137 | * As an approximation to what an average C |
JovanEps | 0:f7463045004e | 138 | * programmer might do, the "register" storage class |
JovanEps | 0:f7463045004e | 139 | * is applied (if enabled by -DROPT) |
JovanEps | 0:f7463045004e | 140 | * - for local variables, if they are used |
JovanEps | 0:f7463045004e | 141 | * (dynamically) five or more times |
JovanEps | 0:f7463045004e | 142 | * - for parameters if they are used (dynamically) |
JovanEps | 0:f7463045004e | 143 | * six or more times |
JovanEps | 0:f7463045004e | 144 | * Note that an optimal "register" strategy is |
JovanEps | 0:f7463045004e | 145 | * compiler-dependent, and that "register" |
JovanEps | 0:f7463045004e | 146 | * declarations do not necessarily lead to faster |
JovanEps | 0:f7463045004e | 147 | * execution. |
JovanEps | 0:f7463045004e | 148 | * -DNOSTRUCTASSIGN (default: Not defined) |
JovanEps | 0:f7463045004e | 149 | * Define if the C compiler does not support |
JovanEps | 0:f7463045004e | 150 | * assignment of structures. |
JovanEps | 0:f7463045004e | 151 | * -DNOENUMS (default: Not defined) |
JovanEps | 0:f7463045004e | 152 | * Define if the C compiler does not support |
JovanEps | 0:f7463045004e | 153 | * enumeration types. |
JovanEps | 0:f7463045004e | 154 | * |
JovanEps | 0:f7463045004e | 155 | ************************************************************************* |
JovanEps | 0:f7463045004e | 156 | * |
JovanEps | 0:f7463045004e | 157 | * Compilation model and measurement (IMPORTANT): |
JovanEps | 0:f7463045004e | 158 | * |
JovanEps | 0:f7463045004e | 159 | * This C version of Dhrystone consists of three files: |
JovanEps | 0:f7463045004e | 160 | * - dhry.h (this file, containing global definitions and comments) |
JovanEps | 0:f7463045004e | 161 | * - dhry_1.c (containing the code corresponding to Ada package Pack_1) |
JovanEps | 0:f7463045004e | 162 | * - dhry_2.c (containing the code corresponding to Ada package Pack_2) |
JovanEps | 0:f7463045004e | 163 | * |
JovanEps | 0:f7463045004e | 164 | * The following "ground rules" apply for measurements: |
JovanEps | 0:f7463045004e | 165 | * - Separate compilation |
JovanEps | 0:f7463045004e | 166 | * - No procedure merging |
JovanEps | 0:f7463045004e | 167 | * - Otherwise, compiler optimizations are allowed but should be |
JovanEps | 0:f7463045004e | 168 | * indicated |
JovanEps | 0:f7463045004e | 169 | * - Default results are those without register declarations |
JovanEps | 0:f7463045004e | 170 | * See the companion paper "Rationale for Dhrystone Version 2" for a more |
JovanEps | 0:f7463045004e | 171 | * detailed discussion of these ground rules. |
JovanEps | 0:f7463045004e | 172 | * |
JovanEps | 0:f7463045004e | 173 | * For 16-Bit processors (e.g. 80186, 80286), times for all compilation |
JovanEps | 0:f7463045004e | 174 | * models ("small", "medium", "large" etc.) should be given if possible, |
JovanEps | 0:f7463045004e | 175 | * together with a definition of these models for the compiler system |
JovanEps | 0:f7463045004e | 176 | * used. |
JovanEps | 0:f7463045004e | 177 | * |
JovanEps | 0:f7463045004e | 178 | ************************************************************************* |
JovanEps | 0:f7463045004e | 179 | * |
JovanEps | 0:f7463045004e | 180 | * Dhrystone (C version) statistics: |
JovanEps | 0:f7463045004e | 181 | * |
JovanEps | 0:f7463045004e | 182 | * [Comment from the first distribution, updated for version 2. |
JovanEps | 0:f7463045004e | 183 | * Note that because of language differences, the numbers are slightly |
JovanEps | 0:f7463045004e | 184 | * different from the Ada version.] |
JovanEps | 0:f7463045004e | 185 | * |
JovanEps | 0:f7463045004e | 186 | * The following program contains statements of a high level programming |
JovanEps | 0:f7463045004e | 187 | * language (here: C) in a distribution considered representative: |
JovanEps | 0:f7463045004e | 188 | * |
JovanEps | 0:f7463045004e | 189 | * assignments 52 (51.0 %) |
JovanEps | 0:f7463045004e | 190 | * control statements 33 (32.4 %) |
JovanEps | 0:f7463045004e | 191 | * procedure, function calls 17 (16.7 %) |
JovanEps | 0:f7463045004e | 192 | * |
JovanEps | 0:f7463045004e | 193 | * 103 statements are dynamically executed. The program is balanced with |
JovanEps | 0:f7463045004e | 194 | * respect to the three aspects: |
JovanEps | 0:f7463045004e | 195 | * |
JovanEps | 0:f7463045004e | 196 | * - statement type |
JovanEps | 0:f7463045004e | 197 | * - operand type |
JovanEps | 0:f7463045004e | 198 | * - operand locality |
JovanEps | 0:f7463045004e | 199 | * operand global, local, parameter, or constant. |
JovanEps | 0:f7463045004e | 200 | * |
JovanEps | 0:f7463045004e | 201 | * The combination of these three aspects is balanced only approximately. |
JovanEps | 0:f7463045004e | 202 | * |
JovanEps | 0:f7463045004e | 203 | * 1. Statement Type: |
JovanEps | 0:f7463045004e | 204 | * ----------------- number |
JovanEps | 0:f7463045004e | 205 | * |
JovanEps | 0:f7463045004e | 206 | * V1 = V2 9 |
JovanEps | 0:f7463045004e | 207 | * (incl. V1 = F(..) |
JovanEps | 0:f7463045004e | 208 | * V = Constant 12 |
JovanEps | 0:f7463045004e | 209 | * Assignment, 7 |
JovanEps | 0:f7463045004e | 210 | * with array element |
JovanEps | 0:f7463045004e | 211 | * Assignment, 6 |
JovanEps | 0:f7463045004e | 212 | * with record component |
JovanEps | 0:f7463045004e | 213 | * -- |
JovanEps | 0:f7463045004e | 214 | * 34 34 |
JovanEps | 0:f7463045004e | 215 | * |
JovanEps | 0:f7463045004e | 216 | * X = Y +|-|"&&"|"|" Z 5 |
JovanEps | 0:f7463045004e | 217 | * X = Y +|-|"==" Constant 6 |
JovanEps | 0:f7463045004e | 218 | * X = X +|- 1 3 |
JovanEps | 0:f7463045004e | 219 | * X = Y *|/ Z 2 |
JovanEps | 0:f7463045004e | 220 | * X = Expression, 1 |
JovanEps | 0:f7463045004e | 221 | * two operators |
JovanEps | 0:f7463045004e | 222 | * X = Expression, 1 |
JovanEps | 0:f7463045004e | 223 | * three operators |
JovanEps | 0:f7463045004e | 224 | * -- |
JovanEps | 0:f7463045004e | 225 | * 18 18 |
JovanEps | 0:f7463045004e | 226 | * |
JovanEps | 0:f7463045004e | 227 | * if .... 14 |
JovanEps | 0:f7463045004e | 228 | * with "else" 7 |
JovanEps | 0:f7463045004e | 229 | * without "else" 7 |
JovanEps | 0:f7463045004e | 230 | * executed 3 |
JovanEps | 0:f7463045004e | 231 | * not executed 4 |
JovanEps | 0:f7463045004e | 232 | * for ... 7 | counted every time |
JovanEps | 0:f7463045004e | 233 | * while ... 4 | the loop condition |
JovanEps | 0:f7463045004e | 234 | * do ... while 1 | is evaluated |
JovanEps | 0:f7463045004e | 235 | * switch ... 1 |
JovanEps | 0:f7463045004e | 236 | * break 1 |
JovanEps | 0:f7463045004e | 237 | * declaration with 1 |
JovanEps | 0:f7463045004e | 238 | * initialization |
JovanEps | 0:f7463045004e | 239 | * -- |
JovanEps | 0:f7463045004e | 240 | * 34 34 |
JovanEps | 0:f7463045004e | 241 | * |
JovanEps | 0:f7463045004e | 242 | * P (...) procedure call 11 |
JovanEps | 0:f7463045004e | 243 | * user procedure 10 |
JovanEps | 0:f7463045004e | 244 | * library procedure 1 |
JovanEps | 0:f7463045004e | 245 | * X = F (...) |
JovanEps | 0:f7463045004e | 246 | * function call 6 |
JovanEps | 0:f7463045004e | 247 | * user function 5 |
JovanEps | 0:f7463045004e | 248 | * library function 1 |
JovanEps | 0:f7463045004e | 249 | * -- |
JovanEps | 0:f7463045004e | 250 | * 17 17 |
JovanEps | 0:f7463045004e | 251 | * --- |
JovanEps | 0:f7463045004e | 252 | * 103 |
JovanEps | 0:f7463045004e | 253 | * |
JovanEps | 0:f7463045004e | 254 | * The average number of parameters in procedure or function calls |
JovanEps | 0:f7463045004e | 255 | * is 1.82 (not counting the function values as implicit parameters). |
JovanEps | 0:f7463045004e | 256 | * |
JovanEps | 0:f7463045004e | 257 | * |
JovanEps | 0:f7463045004e | 258 | * 2. Operators |
JovanEps | 0:f7463045004e | 259 | * ------------ |
JovanEps | 0:f7463045004e | 260 | * number approximate |
JovanEps | 0:f7463045004e | 261 | * percentage |
JovanEps | 0:f7463045004e | 262 | * |
JovanEps | 0:f7463045004e | 263 | * Arithmetic 32 50.8 |
JovanEps | 0:f7463045004e | 264 | * |
JovanEps | 0:f7463045004e | 265 | * + 21 33.3 |
JovanEps | 0:f7463045004e | 266 | * - 7 11.1 |
JovanEps | 0:f7463045004e | 267 | * * 3 4.8 |
JovanEps | 0:f7463045004e | 268 | * / (int div) 1 1.6 |
JovanEps | 0:f7463045004e | 269 | * |
JovanEps | 0:f7463045004e | 270 | * Comparison 27 42.8 |
JovanEps | 0:f7463045004e | 271 | * |
JovanEps | 0:f7463045004e | 272 | * == 9 14.3 |
JovanEps | 0:f7463045004e | 273 | * /= 4 6.3 |
JovanEps | 0:f7463045004e | 274 | * > 1 1.6 |
JovanEps | 0:f7463045004e | 275 | * < 3 4.8 |
JovanEps | 0:f7463045004e | 276 | * >= 1 1.6 |
JovanEps | 0:f7463045004e | 277 | * <= 9 14.3 |
JovanEps | 0:f7463045004e | 278 | * |
JovanEps | 0:f7463045004e | 279 | * Logic 4 6.3 |
JovanEps | 0:f7463045004e | 280 | * |
JovanEps | 0:f7463045004e | 281 | * && (AND-THEN) 1 1.6 |
JovanEps | 0:f7463045004e | 282 | * | (OR) 1 1.6 |
JovanEps | 0:f7463045004e | 283 | * ! (NOT) 2 3.2 |
JovanEps | 0:f7463045004e | 284 | * |
JovanEps | 0:f7463045004e | 285 | * -- ----- |
JovanEps | 0:f7463045004e | 286 | * 63 100.1 |
JovanEps | 0:f7463045004e | 287 | * |
JovanEps | 0:f7463045004e | 288 | * |
JovanEps | 0:f7463045004e | 289 | * 3. Operand Type (counted once per operand reference): |
JovanEps | 0:f7463045004e | 290 | * --------------- |
JovanEps | 0:f7463045004e | 291 | * number approximate |
JovanEps | 0:f7463045004e | 292 | * percentage |
JovanEps | 0:f7463045004e | 293 | * |
JovanEps | 0:f7463045004e | 294 | * Integer 175 72.3 % |
JovanEps | 0:f7463045004e | 295 | * Character 45 18.6 % |
JovanEps | 0:f7463045004e | 296 | * Pointer 12 5.0 % |
JovanEps | 0:f7463045004e | 297 | * String30 6 2.5 % |
JovanEps | 0:f7463045004e | 298 | * Array 2 0.8 % |
JovanEps | 0:f7463045004e | 299 | * Record 2 0.8 % |
JovanEps | 0:f7463045004e | 300 | * --- ------- |
JovanEps | 0:f7463045004e | 301 | * 242 100.0 % |
JovanEps | 0:f7463045004e | 302 | * |
JovanEps | 0:f7463045004e | 303 | * When there is an access path leading to the final operand (e.g. a |
JovanEps | 0:f7463045004e | 304 | * record component), only the final data type on the access path is |
JovanEps | 0:f7463045004e | 305 | * counted. |
JovanEps | 0:f7463045004e | 306 | * |
JovanEps | 0:f7463045004e | 307 | * |
JovanEps | 0:f7463045004e | 308 | * 4. Operand Locality: |
JovanEps | 0:f7463045004e | 309 | * ------------------- |
JovanEps | 0:f7463045004e | 310 | * number approximate |
JovanEps | 0:f7463045004e | 311 | * percentage |
JovanEps | 0:f7463045004e | 312 | * |
JovanEps | 0:f7463045004e | 313 | * local variable 114 47.1 % |
JovanEps | 0:f7463045004e | 314 | * global variable 22 9.1 % |
JovanEps | 0:f7463045004e | 315 | * parameter 45 18.6 % |
JovanEps | 0:f7463045004e | 316 | * value 23 9.5 % |
JovanEps | 0:f7463045004e | 317 | * reference 22 9.1 % |
JovanEps | 0:f7463045004e | 318 | * function result 6 2.5 % |
JovanEps | 0:f7463045004e | 319 | * constant 55 22.7 % |
JovanEps | 0:f7463045004e | 320 | * --- ------- |
JovanEps | 0:f7463045004e | 321 | * 242 100.0 % |
JovanEps | 0:f7463045004e | 322 | * |
JovanEps | 0:f7463045004e | 323 | * |
JovanEps | 0:f7463045004e | 324 | * The program does not compute anything meaningful, but it is |
JovanEps | 0:f7463045004e | 325 | * syntactically and semantically correct. All variables have a value |
JovanEps | 0:f7463045004e | 326 | * assigned to them before they are used as a source operand. |
JovanEps | 0:f7463045004e | 327 | * |
JovanEps | 0:f7463045004e | 328 | * There has been no explicit effort to account for the effects of a |
JovanEps | 0:f7463045004e | 329 | * cache, or to balance the use of long or short displacements for code |
JovanEps | 0:f7463045004e | 330 | * or data. |
JovanEps | 0:f7463045004e | 331 | * |
JovanEps | 0:f7463045004e | 332 | ************************************************************************* |
JovanEps | 0:f7463045004e | 333 | */ |
JovanEps | 0:f7463045004e | 334 | |
JovanEps | 0:f7463045004e | 335 | /* Compiler and system dependent definitions: */ |
JovanEps | 0:f7463045004e | 336 | |
JovanEps | 0:f7463045004e | 337 | #define Mic_secs_Per_Second 1000000.0 |
JovanEps | 0:f7463045004e | 338 | /* Berkeley UNIX C returns process times in seconds/HZ */ |
JovanEps | 0:f7463045004e | 339 | |
JovanEps | 0:f7463045004e | 340 | #ifdef NOSTRUCTASSIGN |
JovanEps | 0:f7463045004e | 341 | #define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) |
JovanEps | 0:f7463045004e | 342 | #else |
JovanEps | 0:f7463045004e | 343 | #define structassign(d, s) d = s |
JovanEps | 0:f7463045004e | 344 | #endif |
JovanEps | 0:f7463045004e | 345 | |
JovanEps | 0:f7463045004e | 346 | #ifdef NOENUM |
JovanEps | 0:f7463045004e | 347 | #define Ident_1 0 |
JovanEps | 0:f7463045004e | 348 | #define Ident_2 1 |
JovanEps | 0:f7463045004e | 349 | #define Ident_3 2 |
JovanEps | 0:f7463045004e | 350 | #define Ident_4 3 |
JovanEps | 0:f7463045004e | 351 | #define Ident_5 4 |
JovanEps | 0:f7463045004e | 352 | typedef int Enumeration; |
JovanEps | 0:f7463045004e | 353 | #else |
JovanEps | 0:f7463045004e | 354 | typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} |
JovanEps | 0:f7463045004e | 355 | Enumeration; |
JovanEps | 0:f7463045004e | 356 | #endif |
JovanEps | 0:f7463045004e | 357 | /* for boolean and enumeration types in Ada, Pascal */ |
JovanEps | 0:f7463045004e | 358 | |
JovanEps | 0:f7463045004e | 359 | /* General definitions: */ |
JovanEps | 0:f7463045004e | 360 | |
JovanEps | 0:f7463045004e | 361 | |
JovanEps | 0:f7463045004e | 362 | #define Null 0 |
JovanEps | 0:f7463045004e | 363 | /* Value of a Null pointer */ |
JovanEps | 0:f7463045004e | 364 | #define true 1 |
JovanEps | 0:f7463045004e | 365 | #define false 0 |
JovanEps | 0:f7463045004e | 366 | |
JovanEps | 0:f7463045004e | 367 | typedef int One_Thirty; |
JovanEps | 0:f7463045004e | 368 | typedef int One_Fifty; |
JovanEps | 0:f7463045004e | 369 | typedef char Capital_Letter; |
JovanEps | 0:f7463045004e | 370 | typedef int Booleann; |
JovanEps | 0:f7463045004e | 371 | typedef char Str_30[31]; |
JovanEps | 0:f7463045004e | 372 | typedef int Arr_1_Dim[25]; /* <-- changed from 50 */ |
JovanEps | 0:f7463045004e | 373 | typedef int Arr_2_Dim[25][25]; /* <-- changed from 50 */ |
JovanEps | 0:f7463045004e | 374 | |
JovanEps | 0:f7463045004e | 375 | typedef struct record |
JovanEps | 0:f7463045004e | 376 | { |
JovanEps | 0:f7463045004e | 377 | struct record *Ptr_Comp; |
JovanEps | 0:f7463045004e | 378 | Enumeration Discr; |
JovanEps | 0:f7463045004e | 379 | union { |
JovanEps | 0:f7463045004e | 380 | struct { |
JovanEps | 0:f7463045004e | 381 | Enumeration Enum_Comp; |
JovanEps | 0:f7463045004e | 382 | int Int_Comp; |
JovanEps | 0:f7463045004e | 383 | char Str_Comp [31]; |
JovanEps | 0:f7463045004e | 384 | } var_1; |
JovanEps | 0:f7463045004e | 385 | struct { |
JovanEps | 0:f7463045004e | 386 | Enumeration E_Comp_2; |
JovanEps | 0:f7463045004e | 387 | char Str_2_Comp [31]; |
JovanEps | 0:f7463045004e | 388 | } var_2; |
JovanEps | 0:f7463045004e | 389 | struct { |
JovanEps | 0:f7463045004e | 390 | char Ch_1_Comp; |
JovanEps | 0:f7463045004e | 391 | char Ch_2_Comp; |
JovanEps | 0:f7463045004e | 392 | } var_3; |
JovanEps | 0:f7463045004e | 393 | } variant; |
JovanEps | 0:f7463045004e | 394 | } Rec_Type, *Rec_Pointer; |
JovanEps | 0:f7463045004e | 395 | |
JovanEps | 0:f7463045004e | 396 | /* Prototypes of function defined in dhry21b.c and called from dhry21a.c. |
JovanEps | 0:f7463045004e | 397 | */ |
JovanEps | 0:f7463045004e | 398 | void Proc_6( Enumeration Enum_Val_Par, Enumeration * Enum_Ref_Par ); |
JovanEps | 0:f7463045004e | 399 | void Proc_7( One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, |
JovanEps | 0:f7463045004e | 400 | One_Fifty * Int_Par_Ref ); |
JovanEps | 0:f7463045004e | 401 | void Proc_8( Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, |
JovanEps | 0:f7463045004e | 402 | int Int_1_Par_Val, int Int_2_Par_Val ); |
JovanEps | 0:f7463045004e | 403 | Enumeration Func_1( Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val ); |
JovanEps | 0:f7463045004e | 404 | Booleann Func_2( Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref ); |
JovanEps | 0:f7463045004e | 405 |