home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / 20memu.zip / OS20MEMU.H < prev    next >
Text File  |  1993-04-24  |  15KB  |  278 lines

  1.  
  2. /******************************************************************************/
  3. /*                                                                            */
  4. /* Filename: OS20MEMU.H                                                       */
  5. /*                                                                            */
  6. /* Version:  1.0                                                              */
  7. /*                                                                            */
  8. /* Purpose:  Header file and definition of variables returned from the        */
  9. /*           OS20MEMU dynalink - OS20MEMU.DLL                                 */
  10. /*                                                                            */
  11. /* Author: Glenn Brew & Ross Cook                                             */
  12. /*                                                                            */
  13. /******************************************************************************/
  14.  
  15. /******************************************************************************/
  16. /*              Function prototype declarations                               */
  17. /******************************************************************************/
  18.  
  19.     /**************************************************************************/
  20.     /* The EP16_GET_GENERAL_INFO function returns a snapshot of memory.       */
  21.     /*                                                                        */
  22.     /* It should be called at any time it is felt the state of system memory  */
  23.     /* has changed such as following the allocation/reallocation of any       */
  24.     /* private data segments.  Also, when programs have started or stopped.   */
  25.     /*                                                                        */
  26.     /* The only parameter to this function is a pointer to a structure of     */
  27.     /* type 'os20memu_general_info'.                                          */
  28.     /*                                                                        */
  29.     /**************************************************************************/
  30.     // USHORT far pascal
  31.     //     EP16_GET_GENERAL_INFO( struct os20memu_general_info far *pgi)
  32.  
  33.  
  34.     /**************************************************************************/
  35.     /* The EP16_GET_PROCESS_INFO function returns detailed data for a process.*/
  36.     /*                                                                        */
  37.     /* It may be called at any time to obtain several data items for a        */
  38.     /* particular process.                                                    */
  39.     /*                                                                        */
  40.     /* The input to this function is a process ID.  Typically, this would be  */
  41.     /* a process ID returned on a previous call to EP16_GET_GENERAL_INFO.     */
  42.     /* The process must be active or an error will be returned.               */
  43.     /*                                                                        */
  44.     /* The output from this function is described in the structure of type    */
  45.     /* 'os20memu_process_details'.                                            */
  46.     /*                                                                        */
  47.     /**************************************************************************/
  48.     // USHORT far pascal
  49.     //     EP16_GET_PROCESS_INFO( USHORT pid,
  50.     //                            struct os20memu_process_details far *ppi);
  51.  
  52. /********************
  53. /*   DLL Version   */
  54. /***********************************************************/
  55. /* Note: See "gi_version" below for more information.      */
  56. /***********************************************************/
  57.  
  58. #define OS20MEMU_VERSION        0x0001  /* Version Number   */
  59.  
  60.  
  61. /******************************/
  62. /*   DLL Return code values   */
  63. /******************************/
  64.                                         /*====================================*/
  65. #define ERROR_UNKNOWN_KERNEL    0xffff  /* The OS/2 system presently in use   */
  66.                                         /* is not 'known' by this DLL.        */
  67.                                         /*                                    */
  68.                                         /* An updated DLL is required.        */
  69.                                         /*                                    */
  70.                                         /* This is a terminal error - there   */
  71.                                         /* there is no recovery and no need   */
  72.                                         /* to retry in the calling program.   */
  73.                                         /*                                    */
  74.                                         /*====================================*/
  75.  
  76.                                         /*====================================*/
  77. #define ERROR_FAULT_OCCURRED    0xfffe  /* A fault occurred while scanning    */
  78.                                         /* the OS/2 system control blocks.    */
  79.                                         /*                                    */
  80.                                         /* The request should be reissued.    */
  81.                                         /*                                    */
  82.                                         /* It may be necessary to increase    */
  83.                                         /* the thread priority of the calling */
  84.                                         /* thread to prevent this error from  */
  85.                                         /* re-occurring.                      */
  86.                                         /*                                    */
  87.                                         /*====================================*/
  88.  
  89.  
  90. /*****************************************/
  91. /*   Structure / data area definitions   */
  92. /*****************************************/
  93.  
  94. /******************************************************************************/
  95. /*   Structure of high level process memory usage data.                       */
  96. /*   An array of these structures is returned at the last entry of the        */
  97. /*   os20memu_general_info structure; see gi_process_data.                    */
  98. /*   That array is variable length and its size should be set = gi_cpids      */
  99. /******************************************************************************/
  100.  
  101. struct  gi_process_data_s {
  102.    USHORT  pd_pid;              // process id
  103.    USHORT  pd_ppid;             // parent process id
  104.    ULONG   pd_cpriv_im;         // count of private pages in memory
  105.    ULONG   pd_cpriv_od;         // count of private pages on disk
  106.    ULONG   pd_cpriv_nt;         // count of private pages not accessed
  107.    ULONG   pd_cshr_im;          // count of shared pages in memory for process
  108.    ULONG   pd_cshr_od;          // count of shared pages on disk for process
  109.    ULONG   pd_cshr_nt;          // count of shared pages not accessed for proc.
  110.    UCHAR   pd_name[14];         // name of process
  111.  
  112. };
  113.  
  114. /******************************************************************************/
  115. /*   Structure of general information.                                        */
  116. /*   A pointer to this structure is provided on a EP16_GET_GENERAL_INFO call  */
  117. /*   and the structure is returned with all data filled in.                   */
  118. /******************************************************************************/
  119.  
  120. struct os20memu_general_info {
  121.    ULONG   gi_version;          // version
  122.  
  123.    ULONG   gi_phys_mem;         // amount of physical storage, in pages
  124.    ULONG   gi_free_mem;         // count of free pages
  125.  
  126.    ULONG   gi_tot_res;          // total resident (fixed) memory
  127.                                 //  not including locked
  128.  
  129.    ULONG   gi_res_sys_mem;      // total number of resident pages contained
  130.                                 //  within the system arena
  131.  
  132.    ULONG   gi_swp_sys_mem;      // total number of swapped out pages that
  133.                                 //  reside in the system arena
  134.                                 //  NOTE: subset of gi_ondisk_swp
  135.  
  136.    ULONG   gi_swappable_sys_mem;// total number of swappable pages that are
  137.                                 //  currently in memory that are located
  138.                                 //  within the system arena
  139.                                 //  NOTE: subset of gi_inmem_swp
  140.  
  141.    ULONG   gi_inmem_swp;        // total number of swappable pages that are
  142.                                 //  currently in memory includes both
  143.                                 //  system and user pages
  144.  
  145.    ULONG   gi_inmem_dsc;        // total number of discardable pages that are
  146.                                 //  currently in memory includes both
  147.                                 //  system and user pages
  148.  
  149.    ULONG   gi_ondisk_dsc;       // total number of discardable pages that are
  150.                                 //  not in memory
  151.  
  152.    ULONG   gi_ondisk_swp;       // total number of swappable pages that are
  153.                                 //  not in memory
  154.  
  155.    ULONG   gi_notacc_swp;       // total number of swappable pages that were
  156.                                 //  allocated (with the commit bit set) but
  157.                                 //  have never been accessed
  158.  
  159.    ULONG   gi_slock_swp;        // short term locks on swappable pages, in pgs
  160.                                 //  NOTE: subset of inmem_swp
  161.  
  162.    ULONG   gi_slock_dsc;        // short term locks on discardable pages, in pgs
  163.                                 //  NOTE: subset of inmem_dsc
  164.  
  165.    ULONG   gi_llock_swp;        // long term locks on swappable pages, in pages
  166.                                 //  NOTE: subset of inmem_swp
  167.  
  168.    ULONG   gi_llock_dsc;        // long term locks on discardable pages, in pgs
  169.                                 //  NOTE: subset of inmem_dsc
  170.  
  171.    // swapper info
  172.    ULONG   gi_swapfile_size;    // size of swapfile in pages
  173.    ULONG   gi_swapfile_inuse;   // number of pages with valid information
  174.    ULONG   gi_swapfile_max_inuse;// maximum inuse page
  175.  
  176.  
  177.    // process info
  178.    ULONG   gi_app_sys_mem_res;  // total amount of resident system memory
  179.                                 //  used to run all processes (IN BYTES)
  180.                                 //  NOTE: subset of res_sys_mem
  181.  
  182.    ULONG   gi_app_sys_mem_im;   // total amount of in memory system storage
  183.                                 //  used to run all processes (IN BYTES)
  184.                                 //  NOTE: subset of swappable_sys_mem
  185.  
  186.    ULONG   gi_app_sys_mem_od;   // total amount of swapped system storage
  187.                                 //  used to run all processes (IN BYTES)
  188.                                 //  NOTE: subset of swp_sys_mem
  189.    // shared arena info
  190.    ULONG   gi_shr_sys_mem_res;  // total amount of resident system memory
  191.    ULONG   gi_shr_sys_mem_im;   // total number of shared pages in memory
  192.    ULONG   gi_shr_sys_mem_od;   // total number of shared pages in memory
  193.  
  194.    ULONG   gi_cshr_im;          // total number of shared pages in memory
  195.                                 //  NOTE: subset of inmem_swp and inmem_dsc
  196.  
  197.    ULONG   gi_cshr_od;          // total number of shared pages on disk
  198.                                 //  NOTE: subset of ondisk_swp and ondisk_dsc
  199.  
  200.    ULONG   gi_cshr_nt;          // total number of shared pages not accessed
  201.                                 //  NOTE: subset of notacc_swp
  202.  
  203.    ULONG   gi_cpids;            // count of processes in gi_process_data array
  204.  
  205.    // per process info
  206.    struct  gi_process_data_s gi_process_data[1]; // array of process records
  207.                                 // The number of entries in this array is
  208.                                 // variable and its contents is complete only
  209.                                 // if its size is => gi_cpids.
  210. };
  211.  
  212.  
  213. /******************************************************************************/
  214. /*   Structure of the detail record of a memory object.                       */
  215. /*   An array of these structures is returned at the last entry of the        */
  216. /*   os20memu_process_details; see pi_object_data.                            */
  217. /*   That array is variable length and its size should be set = the sum of    */
  218. /*   pi_cprivate + pi_cshared.                                                */
  219. /******************************************************************************/
  220.  
  221.  
  222. struct pi_object_data_s {
  223.    ULONG   od_linaddr;          // linear address of object
  224.    ULONG   od_flags;            // object flags
  225.    ULONG   od_size;             // size of object in pages
  226.    ULONG   od_inmem;            // number of pages in memory
  227.    ULONG   od_ondisk;           // number of pages on  disk
  228.    ULONG   od_notacc;           // number of pages that were not accessed
  229.    UCHAR   od_owner_name[14];   // name of executable that allocated the object
  230. };
  231.  
  232. struct os20memu_process_details {
  233.    ULONG   pi_sys_memory_used_res;// current amount of resident system
  234.                                 //  memory being used to run this process
  235.                                 //  (IN BYTES)
  236.  
  237.    ULONG   pi_sys_memory_used_im;// current amount of in memory swappable
  238.                                 //  system storage being used to run
  239.                                 //  this process (IN BYTES)
  240.  
  241.    ULONG   pi_sys_memory_used_od;// current amount of swapped system memory
  242.                                 //  being used to run this process
  243.                                 //  (IN BYTES)
  244.  
  245.    USHORT  pi_cprivate;         // On return, this value will reflect the
  246.                                 // number of objects in the private arena
  247.                                 //
  248.                                 // This variable must be set to the number of
  249.                                 // entries in the pi_object_data array before
  250.                                 // issuing an EP16_GET_PROCESS_INFO request.
  251.  
  252.    USHORT  pi_cshared;          // number of objects in the shared arena
  253.  
  254.    struct pi_object_data_s pi_object_data[1]; // array of object data records
  255.                                 // The number of entries in this array is
  256.                                 // variable and its contents is complete only
  257.                                 // if its size is => the sum of
  258.                                 // pi_cprivate + pi_cshared.
  259. };
  260.  
  261. #define OB_DISCARDABLE 0x40000  // Discardable Object
  262. #define OB_SWAPPABLE   0x20000  // Swappable Object
  263. #define OB_RESIDENT    0x10000  // Resident Object
  264.  
  265. #define OB_LALIAS       0x1000  // Object has aliases
  266. #define OB_SHARED       0x0800  // Object's contents are shared
  267. #define OB_UVIRT        0x0400  // UVirt object
  268. #define OB_ZEROINIT     0x0200  // Object is zero-initialized
  269. #define OB_RES_INIT     0x0100  // Initial allocation was resident
  270. #define OB_LOWMEM       0x0040  // Object is in low memory
  271.  
  272. #define OB_GUARD        0x0080  // Page attribute/permission flags
  273. #define OB_EXEC         0x0020
  274. #define OB_READ         0x0010
  275. #define OB_USER         0x0008
  276. #define OB_WRITE        0x0004
  277.  
  278.