home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / thes3000.exe / theseus0.h < prev    next >
Text File  |  1999-06-04  |  12KB  |  222 lines

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