1 /* 2 ** nmglobal.h 3 ** Global definitions for native mode benchmarks. 4 ** 5 ** BYTEmark (tm) 6 ** BYTE's Native Mode Benchmarks 7 ** Rick Grehan, BYTE Magazine 8 ** 9 ** Creation: 10 ** Revision: 3/95;10/95 11 ** 10/95 - Added memory array & alignment -- RG 12 ** 13 ** DISCLAIMER 14 ** The source, executable, and documentation files that comprise 15 ** the BYTEmark benchmarks are made available on an "as is" basis. 16 ** This means that we at BYTE Magazine have made every reasonable 17 ** effort to verify that the there are no errors in the source and 18 ** executable code. We cannot, however, guarantee that the programs 19 ** are error-free. Consequently, McGraw-HIll and BYTE Magazine make 20 ** no claims in regard to the fitness of the source code, executable 21 ** code, and documentation of the BYTEmark. 22 ** Furthermore, BYTE Magazine, McGraw-Hill, and all employees 23 ** of McGraw-Hill cannot be held responsible for any damages resulting 24 ** from the use of this code or the results obtained from using 25 ** this code. 26 */ 27 28 /* is this a 64 bit architecture? If so, this will define LONG64 */ 29 #include "pointer.h" 30 31 /* 32 ** SYSTEM DEFINES 33 */ 34 35 /* +++ MEMORY +++ */ 36 37 /* 38 ** You must define ONLY ONE of the following identifiers 39 ** to specify the mechanism for allocating memory: 40 ** MALLOCMEM 41 ** DOS16MEM 42 ** MACMEM 43 */ 44 45 /* 46 ** Define MALLOCMEM to use the standard malloc() call for 47 ** memory. This is the default for most systems. 48 */ 49 #define MALLOCMEM 50 51 /* 52 ** Define DOS16MEM if you're running in the old 16-bit segmented 53 ** model. This enables some fruity memory management routines 54 ** required for that model. NOT defining this assumes that 55 ** you're running in an environment that allows malloc() to 56 ** get > 64K chunks of memory. 57 */ 58 /* #define DOS16MEM */ 59 60 /* Define MACMEM to use the Mac's GetPtr call to allocate 61 ** memory (instead of malloc()). 62 */ 63 /* #define MACMEM */ 64 65 /* +++ TIMING +++ */ 66 /* 67 ** You must define ONLY ONE of the following identifiers to pick 68 ** the timing routine used. 69 ** CLOCKWCPS 70 ** CLOCKWCT 71 ** MACTIMEMGR 72 ** WIN31TIMER 73 */ 74 75 /* 76 ** Define CLOCKWCPS if you are using the clock() routine and the 77 ** constant used as the divisor to determine seconds is 78 ** CLOCKS_PER_SEC. This is the default in most cases. 79 */ 80 #define CLOCKWCPS 81 82 /* 83 ** Define CLOCKWCT if you are using the clock() routine and the 84 ** constant used as the divisor to determine seconds is CLK_TCK 85 */ 86 /* #define CLOCKWCT */ 87 88 /* 89 ** Define MACTIMEMGR to use the Mac Time manager routines. 90 ** You'll need to be running at least system 6.0.3 or 91 ** better...extended time manager is recommended (system 7 or 92 ** better). 93 */ 94 /* #define MACTIMEMGR */ 95 96 /* 97 ** Define WIN31TIMER to user the timing routines in TOOLHELP.DLL. 98 ** Gets accuracy down to the millisecond. 99 */ 100 /* #define WIN31TIMER */ 101 102 /* +++ MISCELLANEOUS +++ */ 103 104 /* 105 ** Define DOS16 if you'll be compiling under DOS in 16-bit 106 ** (non DOS-extended) mode. This will enable proper definitions 107 ** for the far*** typedefs 108 */ 109 /* #define DOS16 */ 110 111 /* 112 ** Define MAC if you're compiling on a Macintosh. This 113 ** does a number of things: 114 ** includes unix.h 115 ** Incorporates code to mimic the command line via either 116 ** the console library (Symantec/Think) or the SIOUX 117 ** library (Code Warrior). 118 */ 119 /* #define MAC */ 120 121 /* 122 ** Define LONG64 if your compiler emits 64-bit longs. 123 ** This is typically true of Alpha compilers on Unix 124 ** systems...though, who knows, this may change in the 125 ** future. I MOVED THIS DEFINTION INTO THE FILE pointer.h. DO NOT 126 ** DEFINE IT HERE. IT WILL AUTOMATICALLY BE DEFINED IF NECESSARY. 127 ** Uwe F. Mayer, Dec 15, 1996, Nov 15, 1997 128 */ 129 /* #define LONG64 */ 130 131 /* 132 ** Define MACCWPROF if you are profiling on the Mac using 133 ** Code Warrior. This enables code that turns off the 134 ** profiler in an evern of an error exit. 135 */ 136 /* #define MACCWPROF */ 137 138 #ifdef MAC 139 #include <unix.h> 140 #endif 141 142 /* 143 ** ERROR CODES 144 */ 145 #define ERROR_MEMORY 1 146 #define ERROR_MEMARRAY_FULL 2 147 #define ERROR_MEMARRAY_NFOUND 3 148 #define ERROR_FILECREATE 10 149 #define ERROR_FILEREAD 11 150 #define ERROR_FILEWRITE 12 151 #define ERROR_FILEOPEN 13 152 #define ERROR_FILESEEK 14 153 154 /* 155 ** MINIMUM_TICKS 156 ** 157 ** This sets the default number of minimum ticks. 158 ** It can, of course, be overridden by the input 159 ** command file. 160 ** This ultimately gets loaded into the variable 161 ** global_min_ticks, which specifies the minimum 162 ** number of ticks that must take place between 163 ** a StartStopwatch() and StopStopwatch() call. 164 ** The idea is to reduce error buildup. 165 */ 166 #define MINIMUM_TICKS 60 167 168 /* 169 ** MINIMUM_SECONDS 170 ** 171 ** Minimum number of seconds to run each test. 172 */ 173 #define MINIMUM_SECONDS 5 174 175 /* 176 ** MAXPOSLONG 177 ** 178 ** This is the maximum positive long. 179 */ 180 #ifdef LONG64 181 #define MAXPOSLONG 0x7FFFFFFFFFFFFFFFL 182 #else 183 #define MAXPOSLONG 0x7FFFFFFFL 184 #endif 185 186 /* 187 ** OTHER DEFINES 188 */ 189 #ifndef MAC 190 #define TRUE 1 191 #define FALSE 0 192 #endif 193 194 /* 195 ** Memory array size. Used in SYSSPEC for keeping track 196 ** of re-aligned memory. 197 */ 198 #define MEM_ARRAY_SIZE 20 199 200 /* 201 ** TYPEDEFS 202 */ 203 #define ulong unsigned long 204 #define uchar unsigned char 205 #define uint unsigned int 206 #define ushort unsigned short 207 /* 208 typedef unsigned char uchar; 209 typedef unsigned int uint; 210 typedef unsigned short ushort; 211 typedef unsigned long ulong; 212 */ 213 /* 214 ** The 'farxxx' typedefs were added in deference to DOS, which 215 ** requires far pointers to handle some of the bigger 216 ** memory structures. Other systems will simply 217 ** map 'farxxx' to 'xxx' 218 */ 219 #ifdef DOS16 220 typedef void huge farvoid; 221 typedef double huge fardouble; 222 typedef long huge farlong; 223 typedef unsigned long huge farulong; 224 typedef char huge farchar; 225 typedef unsigned char huge faruchar; 226 227 #else 228 229 typedef void farvoid; 230 typedef double fardouble; 231 typedef long farlong; 232 typedef unsigned long farulong; 233 typedef char farchar; 234 typedef unsigned char faruchar; 235 236 #endif 237 238 /* 239 ** The following typedefs are used when element size 240 ** is critical. You'll have to alter these for 241 ** your specifical platform/compiler. 242 */ 243 typedef unsigned char u8; /* Unsigned 8-bits */ 244 typedef unsigned short u16; /* Unsigned 16 bits */ 245 #ifdef LONG64 246 typedef unsigned int u32; /* Unsigned 32 bits */ 247 typedef int int32; /* Signed 32 bit integer */ 248 #else 249 typedef unsigned long u32; /* Unsigned 32 bits */ 250 typedef long int32; /* Signed 32 bit integer */ 251 #endif 252 253 /***************** 254 ** NUMERIC SORT ** 255 *****************/ 256 /* 257 ** DEFINES 258 */ 259 260 /* 261 ** The following constant, NUMNUMARRAYS (no, it is not a 262 ** Peter Sellers joke) is the maximum number of arrays 263 ** that can be built by the numeric sorting benchmark 264 ** before it gives up. This maximum is dependent on the 265 ** amount of memory in the system. 266 */ 267 /*#define NUMNUMARRAYS 1000*/ 268 #define NUMNUMARRAYS 10000 269 270 /* 271 ** The following constant NUMARRAYSIZE determines the 272 ** default # of elements in each numeric array. Ordinarily 273 ** this is something you shouldn't fool with, though as 274 ** with most of the constants here, it is adjustable. 275 */ 276 #define NUMARRAYSIZE 8111L 277 278 279 /* 280 ** TYPEDEFS 281 */ 282 typedef struct { 283 int adjust; /* Set adjust code */ 284 ulong request_secs; /* # of seconds requested */ 285 double sortspersec; /* # of sort iterations per sec */ 286 ushort numarrays; /* # of arrays */ 287 ulong arraysize; /* # of elements in array */ 288 } SortStruct; 289 290 /**************** 291 ** STRING SORT ** 292 ***************** 293 ** Note: The string sort benchmark uses the same structure to 294 ** communicate parameters as does the numeric sort benchmark. 295 ** (i.e., SortStruct...see above. 296 */ 297 298 /* 299 ** DEFINES 300 */ 301 /* 302 ** The following constant STRINGARRAYSIZE determines 303 ** the default # of bytes allocated to each string array. 304 ** Though the actual size can be pre-set from the command 305 ** file, this constant should be left unchanged. 306 */ 307 #define STRINGARRAYSIZE 8111L 308 309 /************************ 310 ** BITFIELD OPERATIONS ** 311 ************************* 312 */ 313 314 /* 315 ** DEFINES 316 */ 317 318 /* 319 ** Following field sets the size of the bitfield array (in longs). 320 */ 321 #ifdef LONG64 322 #define BITFARRAYSIZE 16384L 323 #else 324 #define BITFARRAYSIZE 32768L 325 #endif 326 327 /* 328 ** TYPEDEFS 329 */ 330 typedef struct { 331 int adjust; /* Set adjust code */ 332 ulong request_secs; /* # of seconds requested */ 333 double bitopspersec; /* # of bitfield ops per sec */ 334 ulong bitoparraysize; /* Total # of bitfield ops */ 335 ulong bitfieldarraysize; /* Bit field array size */ 336 } BitOpStruct; 337 338 /**************************** 339 ** EMULATED FLOATING POINT ** 340 ****************************/ 341 /* 342 ** DEFINES 343 */ 344 #define INTERNAL_FPF_PRECISION 4 345 346 /* 347 ** The following constant is the maximum number of loops 348 ** of the emulated floating point test that the system 349 ** will allow before flagging an error. This is not a 350 ** critical constant, and can be altered if your system is 351 ** a real barn-burner. 352 */ 353 /*#define CPUEMFLOATLOOPMAX 50000L*/ 354 #define CPUEMFLOATLOOPMAX 500000L 355 356 /* 357 ** Set size of array 358 */ 359 #define EMFARRAYSIZE 3000L 360 361 /* 362 ** TYPEDEFS 363 */ 364 typedef struct { 365 int adjust; /* Set adjust code */ 366 ulong request_secs; /* # of seconds requested */ 367 ulong arraysize; /* Size of array */ 368 ulong loops; /* Loops per iterations */ 369 double emflops; /* Results */ 370 } EmFloatStruct; 371 372 /************************* 373 ** FOURIER COEFFICIENTS ** 374 *************************/ 375 376 /* 377 ** TYPEDEFS 378 */ 379 typedef struct { 380 int adjust; /* Set adjust code */ 381 ulong request_secs; /* # of requested seconds */ 382 ulong arraysize; /* Size of coeff. arrays */ 383 double fflops; /* Results */ 384 } FourierStruct; 385 386 /************************* 387 ** ASSIGNMENT ALGORITHM ** 388 *************************/ 389 390 /* 391 ** TYPEDEFS 392 */ 393 typedef struct { 394 int adjust; /* Set adjust code */ 395 ulong request_secs; /* Requested # of seconds */ 396 ulong numarrays; /* # of arrays */ 397 double iterspersec; /* Results */ 398 } AssignStruct; 399 400 /******************** 401 ** IDEA ENCRYPTION ** 402 ********************/ 403 404 /* 405 ** DEFINES 406 */ 407 /* Following constant defines the max number of loops the 408 ** system will attempt. Keeps things from going off into the 409 ** weeds. */ 410 /*#define MAXIDEALOOPS 50000L*/ 411 #define MAXIDEALOOPS 500000L 412 413 /* 414 ** Following constant sets the size of the arrays. 415 ** NOTE: For the IDEA algorithm to work properly, this 416 ** number MUST be some multiple of 8. 417 */ 418 #define IDEAARRAYSIZE 4000L 419 420 /* 421 ** TYPEDEFS 422 */ 423 typedef struct { 424 int adjust; /* Set adjust code */ 425 ulong request_secs; /* Requested # of seconds */ 426 ulong arraysize; /* Size of array */ 427 ulong loops; /* # of times to convert */ 428 double iterspersec; /* Results */ 429 } IDEAStruct; 430 431 432 /************************ 433 ** HUFFMAN COMPRESSION ** 434 ************************/ 435 436 /* 437 ** DEFINES 438 */ 439 /* 440 ** MAXHUFFLOOPS 441 ** 442 ** This constant specifies the maximum number of Huffman 443 ** compression loops the system will try for. This keeps 444 ** the test from going off into the weeds. This is not 445 ** a critical constant, and can be increased if your 446 ** system is a real barn-burner. 447 */ 448 /*#define MAXHUFFLOOPS 50000L*/ 449 #define MAXHUFFLOOPS 500000L 450 451 /* 452 ** Following constant sets the size of the arrays to 453 ** be compressed/uncompressed. 454 */ 455 #define HUFFARRAYSIZE 5000L 456 457 /* 458 ** TYPEDEFS 459 */ 460 461 typedef struct { 462 int adjust; /* Set adjust code */ 463 ulong request_secs; /* Requested # of seconds */ 464 ulong arraysize; /* Size of array */ 465 ulong loops; /* # of times to compress/decompress */ 466 double iterspersec; /* Results */ 467 } HuffStruct; 468 469 /******************************** 470 ** BACK PROPAGATION NEURAL NET ** 471 ********************************/ 472 473 /* 474 ** MAXNNETLOOPS 475 ** 476 ** This constant sets the max number of loops through the neural 477 ** net that the system will attempt before giving up. This 478 ** is not a critical constant. You can alter it if your system 479 ** has sufficient horsepower. 480 */ 481 /*#define MAXNNETLOOPS 50000L*/ 482 #define MAXNNETLOOPS 500000L 483 484 /* 485 ** TYPEDEFS 486 */ 487 typedef struct { 488 int adjust; /* Set adjust code */ 489 ulong request_secs; /* Requested # of seconds */ 490 ulong loops; /* # of times to learn */ 491 double iterspersec; /* Results */ 492 } NNetStruct; 493 494 /*********************** 495 ** LU DECOMPOSITION ** 496 ** (Linear Equations) ** 497 ***********************/ 498 499 /* 500 ** MAXLUARRAYS 501 ** 502 ** This sets the upper limit on the number of arrays 503 ** that the benchmark will attempt to build before 504 ** flagging an error. It is not a critical constant, and 505 ** may be increased if your system has the horsepower. 506 */ 507 /*#define MAXLUARRAYS 1000*/ 508 #define MAXLUARRAYS 10000 509 510 /* 511 ** TYPEDEFS 512 */ 513 typedef struct { 514 int adjust; /* Set adjust code */ 515 ulong request_secs; /* Requested # of seconds */ 516 ulong numarrays; /* # of arrays */ 517 double iterspersec; /* Results */ 518 } LUStruct; 519 520