Microsoft SDK for Java

IJavaEventMonitor::
NotifyEvent

The NotifyEvent method of the IJavaEventMonitor interface is called by the Microsoft VM to notify the profiler when an event from the JVM_EVENT_TYPE enumeration is about to occur. The Microsoft VM passes in the event type and a unique ID. The type of the ID passed is dependent on the type of event that is about to occur.

Syntax

HRESULT NotifyEvent(JVM_EVENT_TYPE event, UniqueID event_id);

Parameters

[in] event The JVM_EVENT_TYPE that is about to occur.
[in] event_id A UniqueID that is interpreted differently depending on the JVM_EVENT_TYPE that is about to occur.

Remarks

The NotifyEvent method receives an event type passed as its first parameter along with a unique ID to some object for the second parameter. The type of the ID passed to NotifyEvent is determined by the event type. The possible event types and the associated unique IDs passed to the NotifyEvent method can be one of the types defined in the JVM_EVENT_TYPE enumeration.

JVM_EVENT_TYPE

Constant Value Description
JVM_EVENT_TYPE_EXCEPTION_OCCURRED 0 An exception occurred. The UniqueID passed as the second parameter is a StackID of the stack frame that the exception handler will be executed in.
JVM_EVENT_TYPE_THREAD_CREATE 4 A Java thread is being created. The UniqueID passed as the second parameter is the ThreadID of the Java thread.
JVM_EVENT_TYPE_THREAD_DESTROY 5 A Java thread is being destroyed. The UniqueID passed as the second parameter is the ThreadID of the Java thread.
JVM_EVENT_TYPE_CLASS_LOAD_STARTED 6 A Java class is starting to be loaded. The UniqueID passed as the second parameter is a pointer to the class name (a UTF-8 string) of the class.
JVM_EVENT_TYPE_CLASS_LOAD_FINISHED 7 A Java class is finished loading. The UniqueID passed as the second parameter is a pointer to the ClassID of the class loaded.
JVM_EVENT_TYPE_CLASS_LOAD_FAILED 17 A Java class failed to be loaded. The UniqueID passed as the second parameter is a pointer to the class name (a UTF-8 string) of the class.
JVM_EVENT_TYPE_CLASS_UNLOAD 8 A Java class is being unloaded. The UniqueID passed as the second parameter is the ClassID of the class.
JVM_EVENT_TYPE_JIT_COMPILE_STARTED 9 The JIT compiler is starting to compile a class method. The UniqueID passed as the second parameter is the MethodID of the class method being compiled.
JVM_EVENT_TYPE_JIT_COMPILE_FINISHED 10 The JIT compiler is finished compiling a class method. The UniqueID passed as the second parameter is the MethodID of the class method that was compiled.
JVM_EVENT_TYPE_GC_STARTED 11 Garbage collection is starting. The UniqueID passed as the second parameter is undefined (this parameter is not used).
JVM_EVENT_TYPE_GC_FINISHED 12 Garbage collection has finished. The UniqueID passed as the second parameter is undefined. (This parameter is not used.)
JVM_EVENT_TYPE_SHUTDOWN 12 The program is exiting. The UniqueID passed as the second parameter is undefined. (This parameter is not used.)
JVM_EVENT_TYPE_RESERVED_14 14 This event type, formerly called JVM_EVENT_TYPE_SHUTDOWN_ERROR, is deprecated and no longer dispatched by the Microsoft VM.
JVM_EVENT_TYPE_RESERVED_15 15 This event type, formerly called JVM_EVENT_TYPE_SHUTDOWN_INTERRUPTED, is deprecated and no longer dispatched by the Microsoft VM.
JVM_EVENT_TYPE_RESERVED_17 17 This formerly reserved event type is now used for JVM_EVENT_TYPE_CLASS_LOAD_FAILED.

Certain events might require special synchronization with the use of methods that operate on the event's parameters. For example, a JVM_EVENT_TYPE_THREAD_DESTROY event might be sent before another thread gets to use the ThreadInformation method. The Microsoft VM does not check that the ID of the thread has been destroyed. Profiler applications should take care to synchronize the destruction events with their uses of these IDs by ensuring that the last use of the ID occurs before returning from handling the destruction event.

Events and IDs that need to be synchronized include these:

JVM_EVENT_TYPE_THREAD_DESTROY

The ThreadID of the destroyed thread can no longer be used by the profiler application.

JVM_EVENT_TYPE_CLASS_UNLOAD

The ClassID, MethodIDs for the methods of the unloaded class, and FieldIDs for fields of the unloaded class can no longer be used by the profiler application.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.