IBM User Guide for Java V7 on Windows > Troubleshooting and support > Using diagnostic tools > Using the JVMTI > IBM JVMTI extensions - API reference



Subscribing to verbose garbage collection logging

You can subscribe to verbose Garbage Collection (GC) data logging through an IBM JVMTI extension.

The RegisterVerboseGCSubscriber() API has the JVMTI Extension function identifier com.ibm.RegisterVerboseGCSubscriber. The identifier is declared as macro COM_IBM_REGISTER_VERBOSEGC_SUBSCRIBER in ibmjvmti.h.

To register a subscription to verbose GC data logging, use:

jvmtiError RegisterVerboseGCSubscriber(jvmtiEnv* jvmti_env, char *description, 
jvmtiVerboseGCSubscriber subscriber, jvmtiVerboseGCAlarm alarm, void

An ASCII character string describing the subscriber must be passed in.

An arbitrary pointer to user data must be supplied. This pointer is passed to the subscriber and alarm functions each time these functions are called. This pointer can be NULL.

A pointer to a subscription ID must be supplied. This pointer is returned by the RegisterVerboseGCSubscriber call if successful. The value must be supplied to a future call to DeregisterVerboseGCSubscriber.

Parameters:

jvmti_env: A pointer to the JVMTI environment.

description: A string that describes your subscriber.

subscriber: A function of type jvmtiVerboseGCSubscriber.

alarm: A function pointer of type jvmtiVerboseGCAlarm.

user_data: User data that is passed to the subscriber function.

subscription_id: A pointer to a subscription identifier that is returned.

Returns:

JVMTI_ERROR_NONE: Success.

JVMTI_ERROR_NULL_POINTER: One of the supplied parameters is null.

JVMTI_ERROR_OUT_OF_MEMORY: There is insufficient system memory to process the request.

JVMTI_ERROR_INVALID_ENVIRONMENT: The jvmti_env parameter is not valid.

JVMTI_ERROR_WRONG_PHASE: The extension has been called outside the JVMTI live phase.

JVMTI_ERROR_NOT_AVAILABLE: GC verbose logging is not available.

JVMTI_ERROR_INTERNAL: An internal error has occurred.


The subscriber function type

The jvmtiVerboseGCSubscriber function is called with the following parameters:

typedef jvmtiError (*jvmtiVerboseGCSubscriber)(jvmtiEnv *jvmti_env, const char *record, jlong length, void *user_data);
The subscriber function must be of type jvmtiVerboseGCSubscriber, which is declared in ibmjvmti.h. This function is called with each record of verbose logging data produced by the JVM. The verbose logging record supplied to the subscriber function is valid only for the duration of the function. If the subscriber wants to save the data, the data must be copied elsewhere. If the subscriber function returns an error, the alarm function is called, and the subscription is de-registered.

Alarm function parameters:

jvmti_env: A pointer to the JVMTI environment.

record: An ascii string that contains a verbose log record.

length: The number of ascii characters in the verbose log record.

user_data: User data supplied when the subscriber is registered.


The alarm function type

The jvmtiVerboseGCAlarm function is called with the following parameters:

typedef jvmtiError (*jvmtiVerboseGCAlarm)(jvmtiEnv *jvmti_env, void *subscription_id, void *user_data);
The alarm function must be of type jvmtiVerboseGCAlarm, which is declared in ibmjvmti.h. This function is called if the subscriber function returns an error.

Alarm function parameters:

jvmti_env: A pointer to the JVMTI environment.

user_data: User data supplied when the subscriber is registered.

subscription_id: The subscription identifier.


Parent: IBM JVMTI extensions - API reference








Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.