jvmri.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*******************************************************************************
  2. * Licensed Materials - Property of IBM
  3. * "Restricted Materials of IBM"
  4. *
  5. * (c) Copyright IBM Corp. 1991, 2015 All Rights Reserved
  6. *
  7. * US Government Users Restricted Rights - Use, duplication or disclosure
  8. * restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *******************************************************************************/
  10. #ifndef _IBM_JVMRAS_H_
  11. #define _IBM_JVMRAS_H_
  12. /*
  13. * ======================================================================
  14. * Allow for inclusion in C++
  15. * ======================================================================
  16. */
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #include "jni.h"
  21. #include "stdarg.h"
  22. /*
  23. * ======================================================================
  24. * Forward declarations
  25. * ======================================================================
  26. */
  27. typedef void (JNICALL *TraceListener)(JNIEnv *env, void **thrLocal, int traceId,
  28. const char * format, va_list varargs);
  29. typedef void (JNICALL *TraceListener50)(JNIEnv *env, void **thrLocal, const char *moduleName,
  30. int traceId, const char * format, va_list varargs);
  31. typedef void (*DgRasOutOfMemoryHook)(void);
  32. /*
  33. * ======================================================================
  34. * RasInfo structures
  35. * ======================================================================
  36. */
  37. typedef struct RasInfo {
  38. int type;
  39. union {
  40. struct {
  41. int number;
  42. char **names;
  43. } query;
  44. struct {
  45. int number;
  46. char **names;
  47. } trace_components;
  48. struct {
  49. char *name;
  50. int first;
  51. int last;
  52. unsigned char *bitMap;
  53. } trace_component;
  54. } info;
  55. } RasInfo;
  56. #define RASINFO_TYPES 0
  57. #define RASINFO_TRACE_COMPONENTS 1
  58. #define RASINFO_TRACE_COMPONENT 2
  59. #define RASINFO_MAX_TYPES 2
  60. /*
  61. * ======================================================================
  62. * External access facade
  63. * ======================================================================
  64. */
  65. #define JVMRAS_VERSION_1_1 0x7F000001
  66. #define JVMRAS_VERSION_1_3 0x7F000003
  67. #define JVMRAS_VERSION_1_5 0x7F000005
  68. typedef struct DgRasInterface {
  69. char eyecatcher[4];
  70. int length;
  71. int version;
  72. int modification;
  73. /* Interface level 1_1 */
  74. int (JNICALL *TraceRegister)(JNIEnv *env, TraceListener func);
  75. int (JNICALL *TraceDeregister)(JNIEnv *env, TraceListener func);
  76. int (JNICALL *TraceSet)(JNIEnv *env, const char *);
  77. void (JNICALL *TraceSnap)(JNIEnv *env, char *);
  78. void (JNICALL *TraceSuspend)(JNIEnv *env);
  79. void (JNICALL *TraceResume)(JNIEnv *env);
  80. int (JNICALL *GetRasInfo)(JNIEnv * env, RasInfo * info_ptr);
  81. int (JNICALL *ReleaseRasInfo)(JNIEnv * env, RasInfo * info_ptr);
  82. int (JNICALL *DumpRegister)(JNIEnv *env,
  83. int (JNICALL *func)(JNIEnv *env2,
  84. void **threadLocal,
  85. int reason));
  86. int (JNICALL *DumpDeregister)(JNIEnv *env,
  87. int (JNICALL *func)(JNIEnv *env2,
  88. void **threadLocal,
  89. int reason));
  90. void (JNICALL *NotifySignal)(JNIEnv *env, int signal);
  91. int (JNICALL *CreateThread)( JNIEnv *env, void (JNICALL *startFunc)(void*),
  92. void *args, int GCSuspend );
  93. int (JNICALL *GenerateJavacore)( JNIEnv *env );
  94. int (JNICALL *RunDumpRoutine)( JNIEnv *env, int componentID, int level,
  95. void (*printrtn)(void *env, const char *tagName,
  96. const char *fmt, ...) );
  97. int (JNICALL *InjectSigsegv)( JNIEnv *env );
  98. int (JNICALL *InjectOutOfMemory)( JNIEnv *env );
  99. int (JNICALL *SetOutOfMemoryHook)( JNIEnv *env, void (*OutOfMemoryFunc)(void) );
  100. int (JNICALL *GetComponentDataArea)( JNIEnv *env, char *componentName,
  101. void **dataArea, int *dataSize );
  102. int (JNICALL *InitiateSystemDump)( JNIEnv *env );
  103. /* Interface level 1_3 follows */
  104. void (JNICALL *DynamicVerbosegc) (JNIEnv *env, int vgc_switch,
  105. int vgccon, char* file_path,
  106. int number_of_files,
  107. int number_of_cycles);
  108. void (JNICALL *TraceSuspendThis)(JNIEnv *env);
  109. void (JNICALL *TraceResumeThis)(JNIEnv *env);
  110. int (JNICALL *GenerateHeapdump)( JNIEnv *env );
  111. /* Interface level 1_5 */
  112. int (JNICALL *TraceRegister50)(JNIEnv *env, TraceListener50 func);
  113. int (JNICALL *TraceDeregister50)(JNIEnv *env, TraceListener50 func);
  114. } DgRasInterface;
  115. /*
  116. * ======================================================================
  117. * Dump exit return codes
  118. * ======================================================================
  119. */
  120. #define RAS_DUMP_CONTINUE 0 /* Continue with diagnostic collection */
  121. #define RAS_DUMP_ABORT 1 /* No more diagnostics should be taken */
  122. /*
  123. * ======================================================================
  124. * Thread Creation types
  125. * ======================================================================
  126. */
  127. #define NO_GC_THREAD_SUSPEND 0 /* Do not suspend thread during CG. */
  128. #define GC_THREAD_SUSPEND 1 /* Suspend thread during CG. */
  129. #define RAS_THREAD_NAME_SIZE 50 /* Size of Ras Thread Name. */
  130. /*
  131. * ======================================================================
  132. * Dump Handler types
  133. * ======================================================================
  134. */
  135. enum dumpType {
  136. NODUMPS = 0,
  137. JAVADUMP = 0x01,
  138. SYSDUMP = 0x02,
  139. CEEDUMP = 0x04,
  140. HEAPDUMP = 0x08,
  141. MAXDUMPTYPES = 6,
  142. /* ensure 4-byte enum */
  143. dumpTypeEnsureWideEnum = 0x1000000
  144. };
  145. #define ALLDUMPS (JAVADUMP | SYSDUMP | CEEDUMP | HEAPDUMP)
  146. #define OSDUMP (ALLDUMPS + 1)
  147. #ifdef __cplusplus
  148. } /* extern "C" */
  149. #endif
  150. #endif /* !_IBM_JVMRAS_H_ */