home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / thes4000.zip / theseus.zip / THES4000.EXE / theseus0.h < prev    next >
Text File  |  2000-10-12  |  13KB  |  233 lines

  1. /*==================================================================+
  2. |                                                                   |
  3. |  IBM Confidential                                                 |
  4. |  Copyright (c) IBM Corporation 1992, 2000.                        |
  5. |  Property of IBM Corporation.                                     |
  6. |  All Rights Reserved.                                             |
  7. |                                                                   |
  8. |  Origins 30 (IBM)                                                 |
  9. |                                                                   |
  10. |  Change Log:                                                                |
  11. |                                                                             |
  12. |  Defect Date     UserID   Reviewer Description                              |
  13. |  ====== ======== ======== ======== ======================================== |
  14. |  240625 05-31-00 hoppes            Changes made for removal of device driver|
  15. |                                                                             |
  16. +==================================================================*/
  17. /* External API definitions for THESEUS2, level 0:
  18.      Level 0 has:
  19.        1. Initialization.
  20.        2. Things that are common to all modes of operation.
  21.        3. System Working Set computations.
  22. */
  23.  
  24. /******************************************************************************/
  25. /* Handle0 definitions:                                                       */
  26. /******************************************************************************/
  27. #ifndef T2HANDLE0_defined
  28.   typedef unsigned long T2HANDLE0;
  29.   #define T2HANDLE0_defined
  30. #endif
  31.  
  32. /******************************************************************************/
  33. /* Initialization definitions:                                                */
  34. /******************************************************************************/
  35. /* Following is prototype of the error "call-back" routine which must be
  36.    implemented by the caller of the level 0 functions.  */
  37. #ifndef error_handler0_defined
  38. #ifdef __IBMC__
  39.   typedef void (* EXPENTRY ERROR_HANDLER0) (T2HANDLE0 t2handle0, ULONG error_code, ULONG p1, ULONG p2);
  40. #else
  41.   typedef void (EXPENTRY *ERROR_HANDLER0) (T2HANDLE0 t2handle0, ULONG error_code, ULONG p1, ULONG p2);
  42. #endif
  43. #endif
  44.   /* The errors returned are (printf's used by THESEUS2 are included):
  45.      error_code p1      p2      explanation
  46.                             Following are returned by "read_linear":
  47.           1     linear  n/a     The starting address (linear) has no page table.
  48.                                 printf( ">>> Linear address: no Page Table, linear=%0.8X.\n", p1);
  49.           2     linear  length  The ending address (linear+length-1) has no page table.
  50.                                 printf( ">>> Linear address+length: no Page Table, linear=%0.8X, length=%0.8X.\n", p1, p2);
  51.           3     linear  n/a     The page at the starting address is not present.
  52.                                 printf( ">>> Linear address: page not present, linear=%0.8X.\n", p1);
  53.           4     linear  length  The page at the ending address (linear+length-1) is not present.
  54.                                 printf( ">>> Linear address+Length: page not present, linear=%0.8X, length=%0.8X.\n", p1, p2);
  55.           5     linear  length  The address+length is greater than 32 bits.
  56.                                 printf( ">>> Linear address+Length: > 32 bits, linear=%0.8X, length=%0.8X.\n", p1, p2);
  57.                             Following is from "working set" initialization:
  58.           6     linear  n/a     The header for the System Arena was not located.
  59.                                 The value found is returned, but is not valid.
  60.                                 System Working Set cannot be measured.
  61.                                 printf( "SystemArenaHeaderLinear = %0.8X.\n", p1);
  62.                                 printf( "SystemArenaHeaderLinear was not properly located.\n");
  63.                                 printf( "System Working Set cannot be measured.\n");
  64.           ?                     Unknown error
  65.                                 printf( "unknown error to error_handler0: error_code=%i, p1=%i, p2=%i.\n", error_code, p1, p2);
  66.   */
  67.  
  68. ULONG EXPENTRY T2Initialize0( ERROR_HANDLER0  error_handler0);
  69.   /* Return code values: */
  70.   #define Theseus3ok                    0
  71.   #define Theseus2BadPTDA               1
  72.   #define Theseus2NoMte                 2
  73.   #define THE_INIT_GLOBAL_FAILED        3
  74.   #define THE_INIT_PAGEFRAME_FAILED     4
  75.   #define THE_INIT_INVALID_OS2VERSION   5
  76.   #define THE_INIT_ERRLOG_OPEN_FAILED   6
  77.  
  78. /*=====================================================================xxxxxx=+
  79. |                                                                      xxxxxx |
  80. +======================================================================xxxxxx*/
  81. VOID EXPENTRY T2Terminate0( VOID );
  82.  
  83. /******************************************************************************/
  84. /* Handle0 definitions (continued):                                           */
  85. /******************************************************************************/
  86. T2HANDLE0 EXPENTRY T2GetHandle0( ERROR_HANDLER0 error_handler0);
  87. VOID      EXPENTRY T2ReleaseHandle0( T2HANDLE0 *t2handle0);
  88.  
  89. /******************************************************************************/
  90. /* Free, Idle, and Locked Memory definitions:                                 */
  91. /******************************************************************************/
  92. /* Function definitions: */
  93. VOID EXPENTRY T2FreeMemory( T2HANDLE0 t2handle0,
  94.                             PULONG    freeRam,   /* # of bytes free. */
  95.                             PULONG    idleRam,   /* # of bytes idle. */
  96.                             PULONG    dirtyRam,  /* # of bytes dirty. */
  97.                             PULONG    LLockRam,  /* # of bytes locked long-term. */
  98.                             PULONG    SLockRam,  /* # of bytes locked short-term. */
  99.                             PULONG    BLockRam); /* # of bytes locked BOTH short- & long-term. */
  100.  
  101. /******************************************************************************/
  102. /* SWAPPER.DAT analysis definitions:                                          */
  103. /******************************************************************************/
  104. /* Function definitions: */
  105. VOID EXPENTRY T2AnalyzeSwapper( T2HANDLE0 t2handle0,
  106.                                 PULONG    SwapUsed,  /* Count of used disk frames in SWAPPER.DAT */
  107.                                 PULONG    SwapFree); /* Count of free disk frames in SWAPPER.DAT */
  108.  
  109. /******************************************************************************/
  110. /* Process List definitions:                                                  */
  111. /******************************************************************************/
  112. /* Constants: */
  113.         /* Maximum # of processes which are allowed. */
  114.         /* (This is the maximum allowed by OS/2 2.0.) */
  115. #define MaxProcesses 4096
  116.         /* Maximum length of a process name (excluding the trailing NULL). */
  117.         /* This is a THESEUS restriction, not a system restriction. */
  118. #define MaxProcessNameLength 8
  119.  
  120. /* Structure definitions: */
  121. struct  _ProcessTableElement {
  122.         USHORT  ptdaPID;        /* PID of this process        */
  123.         USHORT  pidParent;      /* PID of parent              */
  124.         USHORT  cThreads;       /* # of threads found         */
  125.         CHAR    processName [MaxProcessNameLength+1];/* name of the process */
  126.         };
  127. typedef struct _ProcessTableElement PROCESS_TABLE_ELEMENT;
  128. struct  _ProcessTable {
  129.         PROCESS_TABLE_ELEMENT ProcessTable [MaxProcesses];
  130.         };
  131. typedef struct _ProcessTable T2PROCESS_TABLE;
  132.  
  133. /* Function definitions: */
  134. ULONG EXPENTRY T2FindProcesses( T2HANDLE0         t2handle0,
  135.                                 T2PROCESS_TABLE **ProcessTable);
  136.  
  137. /******************************************************************************/
  138. /* RAM List definitions:                                                      */
  139. /******************************************************************************/
  140. /* Structure definitions: */
  141. struct  _ProcessRamElement {
  142.         USHORT  ptdaPID;        /* PID of this process               */
  143.         ULONG   ulPrivate;      /* Private RAM for this process      */
  144.         ULONG   ulShared;       /* Owned-shared RAM for this process */
  145.         CHAR    processName [MaxProcessNameLength+2];/* name of the process */
  146.         };
  147. typedef struct _ProcessRamElement PROCESS_RAM_ELEMENT;
  148. struct  _RamTable {
  149.         PROCESS_RAM_ELEMENT RamTable [MaxProcesses];
  150.         };
  151. typedef struct _RamTable T2RAM_TABLE;
  152.  
  153. /* Function definitions: */
  154. ULONG EXPENTRY T2RamUseByProcess( T2HANDLE0     t2handle0,
  155.                                   T2RAM_TABLE **RamTable,
  156.                                   PULONG        FreeRam);
  157.  
  158. /******************************************************************************/
  159. /* Working Set definitions:                                                   */
  160. /******************************************************************************/
  161. #ifndef WS_HANDLE0_defined
  162.   typedef unsigned long WS_HANDLE0;
  163.   #define WS_HANDLE0_defined
  164. #endif
  165. /* Return code definitions: */
  166. #define T2WS_OK              0
  167. #define T2WS_InUse           1
  168. #define T2WS_SystemBeingDone 2
  169. #define T2WS_InvalidHandle   3
  170. #define T2WS_BadArena        4
  171. #define T2WS_PidNotFound     5
  172.  
  173. /* Function definitions: */
  174. ULONG EXPENTRY T2WSStart( T2HANDLE0   t2handle0,
  175.                           WS_HANDLE0 *ws_handle0,
  176.                           USHORT      ulPID);
  177.   /* Return values are: T2WS_OK, T2WS_InUse, T2WS_SystemBeingDone,
  178.                         T2WS_BadArena, T2WS_PidNotFound. */
  179.  
  180. ULONG EXPENTRY T2WSSystemTick( WS_HANDLE0 ws_handle0,
  181.                                int        iIntervalsForWS,
  182.                                PULONG     ulNow,
  183.                                PULONG     ulWS,
  184.                                PULONG     ulAccessed,
  185.                                PULONG     ulFree,
  186.                                PULONG     ulIdle,
  187.                                PULONG     ulProcessesUsed,
  188.                                PULONG     ulProcessCount,
  189.                                PULONG     ulResident,
  190.                                PULONG     ulTotalRam);
  191.   /* Return values are: T2WS_OK or T2WS_InvalidHandle. */
  192.  
  193. ULONG EXPENTRY T2WSProcessTick( WS_HANDLE0 ws_handle0,
  194.                                 int        iIntervalsForWS,
  195.                                 PULONG     ulNow,
  196.                                 PULONG     ulWS,
  197.                                 PULONG     ulAccessed,
  198.                                 PULONG     ulTotalRam,
  199.                                 PULONG     ulSysNow );
  200. ULONG EXPENTRY T2WSProcessTick2( WS_HANDLE0 ws_handle0,
  201.                                  int        iIntervalsForWS,
  202.                                  PULONG     ulNow,
  203.                                  PULONG     ulWS,
  204.                                  PULONG     ulAccessed,
  205.                                  PULONG     ulDllNow,
  206.                                  PULONG     ulDllWS,
  207.                                  PULONG     ulDllAccessed,
  208.                                  PULONG     ulTotalRam,
  209.                                  PULONG     ulSysNow );
  210.   /* Return values are: T2WS_OK, T2WS_InvalidHandle, or T2WS_PidNotFound. */
  211.  
  212. ULONG EXPENTRY T2WSStop( WS_HANDLE0 *ws_handle0,
  213.                          BOOL       fCollectOne,
  214.                          PULONG     iIntervals,                    /*  xxxxxx*/
  215.                          PULONG     ulMinimum,
  216.                          PULONG     ulRecommended,
  217.                          PULONG     ulAccessed);
  218. ULONG EXPENTRY T2WSStop2( WS_HANDLE0 *ws_handle0,
  219.                           BOOL       fCollectOne,
  220.                           PULONG     iIntervals,                   /*  xxxxxx*/
  221.                           PULONG     ulMinimum,
  222.                           PULONG     ulRecommended,
  223.                           PULONG     ulAccessed,
  224.                           PULONG     ulDllMinimum,
  225.                           PULONG     ulDllRecommended,
  226.                           PULONG     ulDllAccessed);
  227.   /* Return values are: T2WS_OK or T2WS_InvalidHandle. */
  228.  
  229. BOOL  EXPENTRY T2WSCheck( USHORT ulPidToCheck);
  230.   /* Return values are:
  231.      TRUE  = Working set data can be requested for the process or system.
  232.      FALSE = Working set data cannot be requested for the process or system. */
  233.