home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / jreheadf.zip / jvmmi.h < prev    next >
Text File  |  2002-09-19  |  8KB  |  187 lines

  1. /*
  2.  * @(#)src/contract/jvm/sov/jvmmi.h, core, xs131, 20020822 1.4.2.2
  3.  * ===========================================================================
  4.  * Licensed Materials - Property of IBM
  5.  *
  6.  * IBM Java(tm)2 SDK, Standard Edition, v 1.3.1
  7.  * (C) Copyright IBM Corp. 1998, 2001. All Rights Reserved
  8.  * US Government Users Restricted Rights - Use, duplication or disclosure
  9.  * restricted by GSA ADP Schedule Contract with IBM Corp.
  10.  * ===========================================================================
  11.  */
  12.  
  13. /*
  14.  *
  15.  * ===========================================================================
  16.  *
  17.  *
  18.  *
  19.  * ===========================================================================
  20.  * Change activity:
  21.  *
  22.  * Reason  Date   Origin  Description
  23.  * ------  ----   ------  ----------------------------------------------------
  24.  * 028883  250401 hdmsa   Creation
  25.  * 033898  050701 hdrjm   Tidy up - add module information
  26.  * 034149  180701 hdseb   Definition of JVMMI_callback structure for use in
  27.  *                        monitor and object enumeration routines
  28.  * 034693  070801 hdbdp   Definition of JVMMI_callback incorrect
  29.  *
  30.  * ===========================================================================
  31.  * Module Information:
  32.  *
  33.  * DESCRIPTION: Contains definitions/declarations related to JVMMI. This
  34.  * header is likely to be published if the Monitoring Interface is made public.
  35.  * Additional non-public JVMMI elements are defined in ci_jvmmi.h.
  36.  * ===========================================================================
  37.  */
  38.  
  39. #include <jni.h>
  40.  
  41. #define JVMMI_VERSION_1         ((jint)0x00010011)
  42.  
  43.  
  44. /****************************************************************************/
  45. /* Event types which may be monitored                                       */
  46. /****************************************************************************/
  47.  
  48. #define JVMMI_EVENT_COUNT             5  /* Number of events defined */
  49.  
  50. #define JVMMI_EVENT_THREAD_START      0
  51. #define JVMMI_EVENT_THREAD_STOP       1
  52. #define JVMMI_EVENT_CLASS_LOAD        2
  53. #define JVMMI_EVENT_CLASS_UNLOAD      3
  54. #define JVMMI_EVENT_HEAP_DUMP         4
  55.  
  56.  
  57. /****************************************************************************/
  58. /* "Items" which may be enumerated over                                     */
  59. /* Any changes here need to be reflected in jvmmi_enumerateDefinitions      */
  60. /****************************************************************************/
  61.  
  62. #define JVMMI_LIST_COUNT              5           /* Number of lists defined */
  63.  
  64. #define JVMMI_LIST_DEFINITIONS        0x10000000  /* what can be enumerated */
  65. #define JVMMI_LIST_EVENT              0x10000001  /* what events can be monitored */
  66. #define JVMMI_LIST_COMPONENT          0x10000002  /* components, eg st, gc... */
  67. #define JVMMI_LIST_MONITOR            0x10000003  /* monitors */
  68. #define JVMMI_LIST_OBJECT             0x10000004  /* All objects in heap */
  69.  
  70.  
  71. /****************************************************************************/
  72. /* Return codes                                                             */
  73. /****************************************************************************/
  74.  
  75. #define JVMMI_OK     JNI_OK
  76. #define JVMMI_ERR    JNI_ERR
  77. #define JVMMI_OTHER  999
  78.  
  79.  
  80. /****************************************************************************/
  81. /* JVMMI_Event                                                              */
  82. /****************************************************************************/
  83.  
  84. typedef struct JVMMI_Event{
  85.  
  86. /****************************************************************************/
  87. /* NOTE: Any change to this structure may need reflecting in the            */
  88. /* jvmmi_enumerateEvents function.                                          */
  89. /****************************************************************************/
  90.  
  91.     int type;                 /* The type of the event */
  92.     JNIEnv *envID;            /* Env where event occured */
  93.     union{                    /* The valid element of the union is dictated by type */
  94.       struct{
  95.           void *id;           /* Unique ID of monitor */
  96.           int tid;            /* Thread id */
  97.           int flat_inflated;  /* 0 = flat, 1 = inflated */
  98.       } monitor_info;
  99.       struct{
  100.           void *id;           /* Unique ID of object */
  101.           int size;           /* Size of object */
  102.           char *classname;    /* Name of class this is instance of */
  103.       } object_info;
  104.       struct{
  105.           void *id;           /* Unique ID of thread */
  106.       } thread_info;
  107.       struct{
  108.           char *name;         /* Class name */
  109.           char *source;       /* Source file name */
  110.           int interfaces;     /* Number of interfaces */
  111.           int methods;        /* Number of methods */
  112.           int fields;         /* Number of fields */
  113.       } class_info;
  114.       struct{
  115.           int type;           /* Type of object which can be enumerated */
  116.       } enumeration_info;
  117.       struct{
  118.           char name[3];       /* Name of component */
  119.           void *interface;    /* Pointer to components interface */
  120.       } component_info;
  121.       struct{
  122.           int type;           /* Type of event */
  123.           char *detail_name;  /* Name of element in detail union */
  124.           char *elements;     /* List of elements in detail */
  125.           char *description;  /* V brief description of event */
  126.       } event_info;
  127.     } detail;
  128. } JVMMI_Event;
  129.  
  130.  
  131. /****************************************************************************/
  132. /* JVMMI_Interface                                                          */
  133. /****************************************************************************/
  134.  
  135. typedef struct JVMMI_Interface{
  136.     /* Enable a callback to "func" on event type "eventId" */
  137.     int (JNICALL *EnableEvent)(JNIEnv *env,
  138.                                void (JNICALL *func)(JNIEnv *env, JVMMI_Event *evt, void *userData, int tid),
  139.                                void *userData,
  140.                                int eventId);
  141.     /* Disable previously enabled callback to "func" on event type "eventId" */
  142.     int (JNICALL *DisableEvent)(JNIEnv *env,
  143.                                void (JNICALL *func)(JNIEnv *env, JVMMI_Event *evt, void *userData, int tid),
  144.                                void *userData,
  145.                                int eventId);
  146.     /* Request a callback to "func" for each item of type "itemType", up to a maximum of "limit" items */
  147.     int (JNICALL *EnumerateOver)(JNIEnv *env,
  148.                                int itemType,
  149.                                int limit,
  150.                                void (JNICALL *func)(JNIEnv *env, JVMMI_Event *evt, void *userData, int tid),
  151.                                void *userData);
  152. } JVMMI_Interface;
  153.  
  154.  
  155. /****************************************************************************/
  156. /* JVMMI_callbackDetail                                                     */
  157. /****************************************************************************/
  158.  
  159. typedef struct JVMMI_callbackDetail{
  160.     void (JNICALL *func)(JNIEnv *env, JVMMI_Event *evt, void *userData, int tid);
  161.     void *userData;
  162.     char enabledEvents[JVMMI_EVENT_COUNT];
  163.     struct JVMMI_callbackDetail *next;
  164. } JVMMI_callbackDetail;
  165.  
  166.  
  167.  
  168. /****************************************************************************/
  169. /* JVMMI_callback                                                           */
  170. /****************************************************************************/
  171.  
  172. typedef struct JVMMI_callback {                                             /*ibm@34149 starts*/
  173.     void *userdata;
  174.     JNIEnv *env;
  175.     int limit;
  176.     int objcount;
  177.     void (JNICALL *func)(JNIEnv *env, JVMMI_Event *evt, void *userData, int tid);
  178. } JVMMI_callback;                                                            /*ibm@34149 ends ibm@34693*/
  179.  
  180.  
  181. /****************************************************************************/
  182. /* Function declarations                                                    */
  183. /****************************************************************************/
  184.  
  185. JVMMI_Interface * jvmmi_GetInterface_1(JavaVM *vm);
  186.  
  187.