home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / jaseh131.zip / jvmmi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-31  |  8.1 KB  |  188 lines

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