-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.2.1
-
sparc
-
solaris_2.6
The call function
JVMPI_Interface prof_jvm_interface->RequestEvent(JVMPI_EVENT_HEAP_DUMP, void *)
with the predefined integer constant JVMPI_DUMP_LEVEL_0 as a second argument has
no effect on changing the level of heap dump.
======
/* */
/* dump.c */
/* */
#include <jni.h>
#include <stdio.h>
#include <jvmpi.h>
#define CALL(f) (prof_jvm_interface->f)
static void pi_jvm_shut_down_event(void);
static void pi_notify_event(JVMPI_Event *event);
static void spot (void);
static void pi_jvm_heap_dump_event(int);
static void pi_dump_data(void);
JVMPI_Interface *prof_jvm_interface;
JVMPI_RawMonitor data_access_lock;
JVMPI_RawMonitor pi_dump_lock;
jboolean DUMP_ON_EXIT=JNI_TRUE;
JNIEXPORT jint JNICALL
JVM_OnLoad(JavaVM *jvm, char *options, void *reserved) {
int res=(*jvm)->GetEnv(jvm, (void **)&prof_jvm_interface, JVMPI_VERSION_1);
if (res<0)
return JNI_ERR;
fprintf(stderr, "Version of JVMPI is %d\n");
prof_jvm_interface->NotifyEvent=pi_notify_event;
if (CALL(EnableEvent)(JVMPI_EVENT_JVM_SHUT_DOWN, NULL) != JVMPI_SUCCESS) {
return JNI_ERR;
}
pi_dump_lock=CALL(RawMonitorCreate)("_pi_dump_lock");
return JNI_OK;
}
static void pi_notify_event(JVMPI_Event *event) {
switch(event->event_type) {
case JVMPI_EVENT_JVM_SHUT_DOWN:
pi_jvm_shut_down_event();
return;
case JVMPI_EVENT_DUMP_DATA_REQUEST:
CALL(RawMonitorEnter)(pi_dump_lock);
pi_dump_data();
CALL(RawMonitorExit)(pi_dump_lock);
case JVMPI_EVENT_HEAP_DUMP | JVMPI_REQUESTED_EVENT:
pi_jvm_heap_dump_event(event->u.heap_dump.dump_level);
return;
default:
spot();
}
}
static void pi_jvm_shut_down_event() {
fprintf(stderr, "Shutdown...\n");
if(DUMP_ON_EXIT)
pi_dump_data();
else CALL(RawMonitorExit)(pi_dump_lock);
}
static void pi_dump_data() {
fprintf(stderr,"pi_dump_data...\n");
if (CALL(RequestEvent)(JVMPI_EVENT_HEAP_DUMP, JVMPI_DUMP_LEVEL_0) != JVMPI_SUCCESS)
fprintf(stderr,"Dump didn't succeded\n");
}
static void spot (void) {
fprintf(stderr, "Spot here\n");
}
static void pi_jvm_heap_dump_event(int dump_level) {
fprintf(stderr, "pi_jvm_heap_dump_event...\n");
fprintf(stderr, "Dump level (should be 0) %d\n", dump_level);
}
%cc -G -I$JAVAHOME/include -I$JAVAHOME/include/solaris dump.c -o libdump.so
%$JAVAHOME/bin/java -version
java version "1.2.1"
Classic VM (build JDK-1.2.1-A, green threads, sunwjit)
%LD_LIBRARY_PATH=. $JAVAHOME/bin/java -Xrundump FooClass
Version of JVMPI is 268435457
Just foo
1 2 3 4 5
Shutdown...
pi_dump_data...
pi_jvm_heap_dump_event...
Dump level (should be 0) 2
%
konstantin.boudnik@eng 1999-06-03
JVMPI_Interface prof_jvm_interface->RequestEvent(JVMPI_EVENT_HEAP_DUMP, void *)
with the predefined integer constant JVMPI_DUMP_LEVEL_0 as a second argument has
no effect on changing the level of heap dump.
======
/* */
/* dump.c */
/* */
#include <jni.h>
#include <stdio.h>
#include <jvmpi.h>
#define CALL(f) (prof_jvm_interface->f)
static void pi_jvm_shut_down_event(void);
static void pi_notify_event(JVMPI_Event *event);
static void spot (void);
static void pi_jvm_heap_dump_event(int);
static void pi_dump_data(void);
JVMPI_Interface *prof_jvm_interface;
JVMPI_RawMonitor data_access_lock;
JVMPI_RawMonitor pi_dump_lock;
jboolean DUMP_ON_EXIT=JNI_TRUE;
JNIEXPORT jint JNICALL
JVM_OnLoad(JavaVM *jvm, char *options, void *reserved) {
int res=(*jvm)->GetEnv(jvm, (void **)&prof_jvm_interface, JVMPI_VERSION_1);
if (res<0)
return JNI_ERR;
fprintf(stderr, "Version of JVMPI is %d\n");
prof_jvm_interface->NotifyEvent=pi_notify_event;
if (CALL(EnableEvent)(JVMPI_EVENT_JVM_SHUT_DOWN, NULL) != JVMPI_SUCCESS) {
return JNI_ERR;
}
pi_dump_lock=CALL(RawMonitorCreate)("_pi_dump_lock");
return JNI_OK;
}
static void pi_notify_event(JVMPI_Event *event) {
switch(event->event_type) {
case JVMPI_EVENT_JVM_SHUT_DOWN:
pi_jvm_shut_down_event();
return;
case JVMPI_EVENT_DUMP_DATA_REQUEST:
CALL(RawMonitorEnter)(pi_dump_lock);
pi_dump_data();
CALL(RawMonitorExit)(pi_dump_lock);
case JVMPI_EVENT_HEAP_DUMP | JVMPI_REQUESTED_EVENT:
pi_jvm_heap_dump_event(event->u.heap_dump.dump_level);
return;
default:
spot();
}
}
static void pi_jvm_shut_down_event() {
fprintf(stderr, "Shutdown...\n");
if(DUMP_ON_EXIT)
pi_dump_data();
else CALL(RawMonitorExit)(pi_dump_lock);
}
static void pi_dump_data() {
fprintf(stderr,"pi_dump_data...\n");
if (CALL(RequestEvent)(JVMPI_EVENT_HEAP_DUMP, JVMPI_DUMP_LEVEL_0) != JVMPI_SUCCESS)
fprintf(stderr,"Dump didn't succeded\n");
}
static void spot (void) {
fprintf(stderr, "Spot here\n");
}
static void pi_jvm_heap_dump_event(int dump_level) {
fprintf(stderr, "pi_jvm_heap_dump_event...\n");
fprintf(stderr, "Dump level (should be 0) %d\n", dump_level);
}
%cc -G -I$JAVAHOME/include -I$JAVAHOME/include/solaris dump.c -o libdump.so
%$JAVAHOME/bin/java -version
java version "1.2.1"
Classic VM (build JDK-1.2.1-A, green threads, sunwjit)
%LD_LIBRARY_PATH=. $JAVAHOME/bin/java -Xrundump FooClass
Version of JVMPI is 268435457
Just foo
1 2 3 4 5
Shutdown...
pi_dump_data...
pi_jvm_heap_dump_event...
Dump level (should be 0) 2
%
konstantin.boudnik@eng 1999-06-03