home *** CD-ROM | disk | FTP | other *** search
/ PC User 1997 April / PCU_APR_97.ISO / utils / cpu / cpuinfo / source / cpuinf16 / speed.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-13  |  4.6 KB  |  133 lines

  1. /***************************************************************
  2. *
  3. * C file:   speed.h... for cpuinf16 DLL
  4. *
  5. *       This program has been developed by Intel Corporation.  
  6. *        You have Intel's permission to incorporate this code 
  7. *       into your product, royalty free.  Intel has various 
  8. *        intellectual property rights which it may assert under
  9. *       certain circumstances, such as if another manufacturer's
  10. *       processor mis-identifies itself as being "GenuineIntel"
  11. *        when the CPUID instruction is executed.
  12. *
  13. *       Intel specifically disclaims all warranties, express or
  14. *       implied, and all liability, including consequential and
  15. *        other indirect damages, for the use of this code, 
  16. *        including liability for infringement of any proprietary
  17. *        rights, and including the warranties of merchantability
  18. *        and fitness for a particular purpose.  Intel does not 
  19. *        assume any responsibility for any errors which may 
  20. *        appear in this code nor any responsibility to update it.
  21. *
  22. *  * Other brands and names are the property of their respective
  23. *    owners.
  24. *
  25. *  Copyright (c) 1995, Intel Corporation.  All rights reserved.
  26. ***************************************************************/
  27.  
  28. #ifndef speed_h
  29. #define speed_h
  30.  
  31.  
  32.  
  33. // CONSTANT DEFINITIONS ////////////////////////////////////////
  34.  
  35.     // GENERIC CONSTANTS ///////////////////////////////////////
  36. #define MAXCLOCKS        150        // Maximum number of cycles per
  37.                                 //   BSF instruction
  38.  
  39. #define CLONE_MASK        0x8000    // Mask to be 'OR'ed with proc-
  40.                                 //   essor family type
  41.  
  42.     // ACCURACY AFFECTING CONSTANTS ////////////////////////////
  43. #define ITERATIONS        4000    // Number of times to repeat BSF
  44.                                 //   instruction in samplings.
  45.                                 //   Initially set to 4000.
  46.                                 //   NOTE-- Set this value
  47.                                 //   identically in timeproc.asm
  48.  
  49. #define INITIAL_DELAY    3        // Number of ticks to wait 
  50.                                 //   through before starting 
  51.                                 //   test sampling. Initially
  52.                                 //   set to 3.
  53.                             
  54. #define SAMPLING_DELAY    60        // Number of ticks to allow to
  55.                                 //   to elapse during sampling.
  56.                                 //   Initially set to 60.
  57.  
  58. #define TOLERANCE        2        // Number of MHz to allow
  59.                                 //   samplings to deviate from
  60.                                 //   average of samplings.
  61.                                 //   Initially set to 2.
  62.                                 
  63. #define MAX_TRIES        20        // Maximum number of samplings
  64.                                 //   to allow before giving up
  65.                                 //   and returning current 
  66.                                 //   average. Initially set to
  67.                                 //   20.                                                                
  68.  
  69. #define    SAMPLINGS        10        // Number of BSF sequence 
  70.                                 //   samplings to make.
  71.                                 //   Initially set to 10.
  72.                                 
  73. // VARIABLE STRUCTURE DEFINITIONS //////////////////////////////
  74. struct FREQ_INFO
  75. {
  76.     unsigned long in_cycles;    // Internal clock cycles during
  77.                                 //   test
  78.                                 
  79.     unsigned long ex_ticks;        // Microseconds elapsed during 
  80.                                 //   test
  81.                                 
  82.     unsigned long raw_freq;        // Raw frequency of CPU in MHz
  83.     
  84.     unsigned long norm_freq;    // Normalized frequency of CPU
  85.                                 //   in MHz.
  86. };
  87.  
  88.  
  89. typedef unsigned short ushort;
  90. typedef unsigned long  ulong;
  91.  
  92.  
  93.  
  94. /***************************************************************
  95. * LibMain() -- Windows entry procedure for DLLSs
  96. ***************************************************************/
  97. int FAR PASCAL _export LibMain(HANDLE hndInstance, 
  98.                                WORD wDataSeg,
  99.                                WORD cbHeapSize, 
  100.                                LPSTR lpszCmdLine);
  101.  
  102.  
  103. /***************************************************************
  104. * WEP() -- Windows exit procedure for the DLLs.
  105. *
  106. ***************************************************************/
  107. int FAR PASCAL _export WEP(int nParam);
  108.  
  109.  
  110. /***************************************************************
  111. * CpuSpeed() -- Return the raw clock rate of the host CPU.
  112. *
  113. * Inputs:
  114. *    clocks:        NULL: Use default value for number of cycles
  115. *                   per BSF instruction.
  116. *               Positive Integer: Use clocks value for number
  117. *                   of cycles per BSF instruction.
  118. *
  119. * Returns:
  120. *        If error then return all zeroes in FREQ_INFO structure
  121. *        Else return FREQ_INFO structure containing calculated 
  122. *       clock frequency, normalized clock frequency, number of 
  123. *       clock cycles during test sampling, and the number of 
  124. *       microseconds elapsed during the sampling.
  125. ***************************************************************/
  126. struct FREQ_INFO FAR PASCAL _export cpuspeed(int clocks);
  127. unsigned long FAR PASCAL _export cpurawspeed(int clocks);
  128. unsigned long FAR PASCAL _export cpunormspeed(int clocks);
  129. unsigned long FAR PASCAL _export ProcessorCount();
  130.  
  131. #endif speed_h
  132.