home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / bytewarp.zip / NMGLOBAL.H < prev    next >
C/C++ Source or Header  |  1995-11-02  |  13KB  |  494 lines

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