#include "hprof.h"#include "java_crw_demo.h"
Go to the source code of this file.
Defines | |
| #define | DEFAULT_TXT_SUFFIX ".txt" |
| #define | DEFAULT_OUTPUTFILE "java.hprof" |
| #define | DEFAULT_OUTPUTTEMP "java.hprof.temp" |
| #define | EXPERIMENT_NO_EARLY_HOOK 0x1 |
| #define | DEFAULT_TRACE_DEPTH 4 |
| #define | DEFAULT_SAMPLE_INTERVAL 10 |
| #define | DEFAULT_CUTOFF_POINT 0.0001 |
| #define | _TO_STR(a) #a |
| #define | TO_STR(a) _TO_STR(a) |
| #define | BEGIN_CALLBACK() |
| #define | END_CALLBACK() |
Functions | |
| static void | set_callbacks (jboolean on) |
| static GlobalData * | get_gdata (void) |
| static void | my_crw_fatal_error_handler (const char *msg, const char *file, int line) |
| static void | list_all_tables (void) |
| static int | connect_to_socket (char *hostname, unsigned short port) |
| static void | make_unique_filename (char **filename) |
| static int | get_tok (char **src, char *buf, int buflen, int sep) |
| static jboolean | setBinarySwitch (char **src, jboolean *ptr) |
| static void | print_usage (void) |
| static void | option_error (char *description) |
| static void | parse_options (char *command_line_options) |
| static void | reset_all_data (void) |
| static void | reset_class_load_status (JNIEnv *env, jthread thread) |
| static void | dump_all_data (JNIEnv *env) |
| static void | object_free_cleanup (JNIEnv *env, jboolean force_class_table_reset) |
| static void JNICALL | gc_finish_watcher (jvmtiEnv *jvmti, JNIEnv *env, void *p) |
| static void | setup_event_mode (jboolean onload_set_only, jvmtiEventMode state) |
| static void JNICALL | cbVMInit (jvmtiEnv *jvmti, JNIEnv *env, jthread thread) |
| static void JNICALL | cbVMDeath (jvmtiEnv *jvmti, JNIEnv *env) |
| static void JNICALL | cbThreadStart (jvmtiEnv *jvmti, JNIEnv *env, jthread thread) |
| static void JNICALL | cbThreadEnd (jvmtiEnv *jvmti, JNIEnv *env, jthread thread) |
| static void JNICALL | cbClassFileLoadHook (jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_being_redefined, jobject loader, const char *name, jobject protection_domain, jint class_data_len, const unsigned char *class_data, jint *new_class_data_len, unsigned char **new_class_data) |
| static void JNICALL | cbClassLoad (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jclass klass) |
| static void JNICALL | cbClassPrepare (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jclass klass) |
| static void JNICALL | cbDataDumpRequest (jvmtiEnv *jvmti) |
| static void JNICALL | cbExceptionCatch (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jmethodID method, jlocation location, jobject exception) |
| static void JNICALL | cbMonitorWait (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object, jlong timeout) |
| static void JNICALL | cbMonitorWaited (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object, jboolean timed_out) |
| static void JNICALL | cbMonitorContendedEnter (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object) |
| static void JNICALL | cbMonitorContendedEntered (jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object) |
| static void JNICALL | cbGarbageCollectionStart (jvmtiEnv *jvmti) |
| static void JNICALL | cbGarbageCollectionFinish (jvmtiEnv *jvmti) |
| static void JNICALL | cbObjectFree (jvmtiEnv *jvmti, jlong tag) |
| static void | getCapabilities (void) |
| static void * | load_library (char *name) |
| static void * | lookup_library_symbol (void *library, char **symbols, int nsymbols) |
| JNIEXPORT jint JNICALL | Agent_OnLoad (JavaVM *vm, char *options, void *reserved) |
| JNIEXPORT void JNICALL | Agent_OnUnload (JavaVM *vm) |
Variables | |
| GlobalData * | gdata |
| #define _TO_STR | ( | a | ) | #a |
Definition at line 81 of file hprof_init.c.
| #define BEGIN_CALLBACK | ( | ) |
{ /* BEGIN OF CALLBACK */ \
jboolean bypass; \
rawMonitorEnter(gdata->callbackLock); \
if (gdata->vm_death_callback_active) { \
/* VM_DEATH is active, we will bypass the CALLBACK CODE */ \
bypass = JNI_TRUE; \
rawMonitorExit(gdata->callbackLock); \
/* Bypassed CALLBACKS block here until VM_DEATH done */ \
rawMonitorEnter(gdata->callbackBlock); \
rawMonitorExit(gdata->callbackBlock); \
} else { \
/* We will be executing the CALLBACK CODE in this case */ \
gdata->active_callbacks++; \
bypass = JNI_FALSE; \
rawMonitorExit(gdata->callbackLock); \
} \
if ( !bypass ) { \
Definition at line 103 of file hprof_init.c.
| #define DEFAULT_CUTOFF_POINT 0.0001 |
Definition at line 78 of file hprof_init.c.
| #define DEFAULT_OUTPUTFILE "java.hprof" |
Definition at line 62 of file hprof_init.c.
| #define DEFAULT_OUTPUTTEMP "java.hprof.temp" |
Definition at line 63 of file hprof_init.c.
| #define DEFAULT_SAMPLE_INTERVAL 10 |
Definition at line 75 of file hprof_init.c.
| #define DEFAULT_TRACE_DEPTH 4 |
Definition at line 72 of file hprof_init.c.
| #define DEFAULT_TXT_SUFFIX ".txt" |
Definition at line 61 of file hprof_init.c.
| #define END_CALLBACK | ( | ) |
/* Part of bypass if body */ \ rawMonitorEnter(gdata->callbackLock); \ gdata->active_callbacks--; \ /* If VM_DEATH is active, and last one, send notify. */ \ if (gdata->vm_death_callback_active) { \ if (gdata->active_callbacks == 0) { \ rawMonitorNotifyAll(gdata->callbackLock); \ } \ } \ rawMonitorExit(gdata->callbackLock); \ /* Non-Bypassed CALLBACKS block here until VM_DEATH done */ \ rawMonitorEnter(gdata->callbackBlock); \ rawMonitorExit(gdata->callbackBlock); \ } \ }
Definition at line 123 of file hprof_init.c.
| #define EXPERIMENT_NO_EARLY_HOOK 0x1 |
Definition at line 69 of file hprof_init.c.
| #define TO_STR | ( | a | ) | _TO_STR(a) |
Definition at line 82 of file hprof_init.c.
| JNIEXPORT jint JNICALL Agent_OnLoad | ( | JavaVM * | vm, | |
| char * | options, | |||
| void * | reserved | |||
| ) |
Definition at line 1938 of file hprof_init.c.


| JNIEXPORT void JNICALL Agent_OnUnload | ( | JavaVM * | vm | ) |
| static void JNICALL cbClassFileLoadHook | ( | jvmtiEnv * | jvmti_env, | |
| JNIEnv * | env, | |||
| jclass | class_being_redefined, | |||
| jobject | loader, | |||
| const char * | name, | |||
| jobject | protection_domain, | |||
| jint | class_data_len, | |||
| const unsigned char * | class_data, | |||
| jint * | new_class_data_len, | |||
| unsigned char ** | new_class_data | |||
| ) | [static] |
Definition at line 1448 of file hprof_init.c.


| static void JNICALL cbClassLoad | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jclass | klass | |||
| ) | [static] |
Definition at line 1582 of file hprof_init.c.


| static void JNICALL cbClassPrepare | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jclass | klass | |||
| ) | [static] |
Definition at line 1605 of file hprof_init.c.


| static void JNICALL cbDataDumpRequest | ( | jvmtiEnv * | jvmti | ) | [static] |
Definition at line 1630 of file hprof_init.c.


| static void JNICALL cbExceptionCatch | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jmethodID | method, | |||
| jlocation | location, | |||
| jobject | exception | |||
| ) | [static] |
Definition at line 1662 of file hprof_init.c.


| static void JNICALL cbGarbageCollectionFinish | ( | jvmtiEnv * | jvmti | ) | [static] |
Definition at line 1736 of file hprof_init.c.


| static void JNICALL cbGarbageCollectionStart | ( | jvmtiEnv * | jvmti | ) | [static] |
Definition at line 1723 of file hprof_init.c.


| static void JNICALL cbMonitorContendedEnter | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jobject | object | |||
| ) | [static] |
Definition at line 1699 of file hprof_init.c.


| static void JNICALL cbMonitorContendedEntered | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jobject | object | |||
| ) | [static] |
Definition at line 1711 of file hprof_init.c.


| static void JNICALL cbMonitorWait | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jobject | object, | |||
| jlong | timeout | |||
| ) | [static] |
Definition at line 1675 of file hprof_init.c.


| static void JNICALL cbMonitorWaited | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread, | |||
| jobject | object, | |||
| jboolean | timed_out | |||
| ) | [static] |
Definition at line 1687 of file hprof_init.c.


| static void JNICALL cbObjectFree | ( | jvmtiEnv * | jvmti, | |
| jlong | tag | |||
| ) | [static] |
Definition at line 1763 of file hprof_init.c.


| static void JNICALL cbThreadEnd | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread | |||
| ) | [static] |
Definition at line 1437 of file hprof_init.c.


| static void JNICALL cbThreadStart | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread | |||
| ) | [static] |
Definition at line 1426 of file hprof_init.c.


| static void JNICALL cbVMDeath | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env | |||
| ) | [static] |
Definition at line 1253 of file hprof_init.c.


| static void JNICALL cbVMInit | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| jthread | thread | |||
| ) | [static] |
Definition at line 1139 of file hprof_init.c.


| static int connect_to_socket | ( | char * | hostname, | |
| unsigned short | port | |||
| ) | [static] |
Socket connection
Definition at line 236 of file hprof_init.c.


| static void dump_all_data | ( | JNIEnv * | env | ) | [static] |
Definition at line 878 of file hprof_init.c.


| static void JNICALL gc_finish_watcher | ( | jvmtiEnv * | jvmti, | |
| JNIEnv * | env, | |||
| void * | p | |||
| ) | [static] |
Definition at line 1021 of file hprof_init.c.


| static GlobalData* get_gdata | ( | void | ) | [static] |
| static int get_tok | ( | char ** | src, | |
| char * | buf, | |||
| int | buflen, | |||
| int | sep | |||
| ) | [static] |
| static void getCapabilities | ( | void | ) | [static] |
Definition at line 1835 of file hprof_init.c.


| static void list_all_tables | ( | void | ) | [static] |
Definition at line 210 of file hprof_init.c.


| static void* load_library | ( | char * | name | ) | [static] |
Definition at line 1884 of file hprof_init.c.


| static void* lookup_library_symbol | ( | void * | library, | |
| char ** | symbols, | |||
| int | nsymbols | |||
| ) | [static] |
Definition at line 1912 of file hprof_init.c.


| static void make_unique_filename | ( | char ** | filename | ) | [static] |
Definition at line 256 of file hprof_init.c.


| static void my_crw_fatal_error_handler | ( | const char * | msg, | |
| const char * | file, | |||
| int | line | |||
| ) | [static] |
Definition at line 199 of file hprof_init.c.


| static void object_free_cleanup | ( | JNIEnv * | env, | |
| jboolean | force_class_table_reset | |||
| ) | [static] |
Definition at line 970 of file hprof_init.c.


| static void option_error | ( | char * | description | ) | [static] |
Definition at line 484 of file hprof_init.c.


| static void parse_options | ( | char * | command_line_options | ) | [static] |
Definition at line 496 of file hprof_init.c.


| static void print_usage | ( | void | ) | [static] |
| static void reset_all_data | ( | void | ) | [static] |
Definition at line 857 of file hprof_init.c.


| static void reset_class_load_status | ( | JNIEnv * | env, | |
| jthread | thread | |||
| ) | [static] |
Definition at line 918 of file hprof_init.c.


| static void set_callbacks | ( | jboolean | on | ) | [static] |
Definition at line 1787 of file hprof_init.c.


| static jboolean setBinarySwitch | ( | char ** | src, | |
| jboolean * | ptr | |||
| ) | [static] |
Definition at line 355 of file hprof_init.c.


| static void setup_event_mode | ( | jboolean | onload_set_only, | |
| jvmtiEventMode | state | |||
| ) | [static] |
Definition at line 1089 of file hprof_init.c.


Definition at line 66 of file hprof_init.c.
1.6.1