Method name from JVMPI

HI all,

Using JVMPI, how do I get the name of the method which was called and the class name from which the method was called. in the JVMPI_Event, the union method, has only one field jmethodId. From this how can i figure out the name of the method and the invoking class?

Thanks in advance,

sujith.

[331 byte] By [PPSujith] at [2007-9-26 11:03:04]
# 1

Either you register for CLASS_LOAD events right away and store this inforamtion inside your profiler and/or you request this event evereytime you encounter an unknown method ID.

//* C++-Syntax, no explicit "this" argument for jvmpi interface pointer!

jvmpi->RequestEvent(JVMPI_EVENT_CLASS_LOAD, jvmpi->GetMethodClass(method_id));

//* you obviously need to include this event in your notifyEvent(JVMPI_Event*) function

thpreusser at 2007-7-1 23:53:55 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

> Either you register for CLASS_LOAD events right away

> and store this inforamtion inside your profiler and/or

> you request this event evereytime you encounter an

> unknown method ID.

> > //* C++-Syntax, no explicit "this" argument for jvmpi

> interface pointer!

> jvmpi->RequestEvent(JVMPI_EVENT_CLASS_LOAD,

> jvmpi->GetMethodClass(method_id));

>

> //* you obviously need to include this event in your

> notifyEvent(JVMPI_Event*) function

>

Actually, I am using the METHOD_ENTRY_EVENT2.

void notifyEvent(JVMPI_Event *event) {

switch(event->event_type) {

case JVMPI_EVENT_METHOD_ENTRY2:

........................................................

In the dotted place, I want to print the method name invoked to the console. But in the event->u.method, there is no string which gives the method name like in the

"event->u.class_load.class_name" where i can get the name of the class loaded.

Could you please tell me a method of how I can get the method name?

Thanxs for the reply,

sujith.

PPSujith at 2007-7-1 23:53:55 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

Well, I just told you! You get the method_id, right? And the only way you get the method name is by requesting its defining event. That's exactly what the code snippet I gave you does. There is no short circuit. Want to go through the doc again and prove me wrong? Would be my pleasure:

http://java.sun.com/products/jdk/1.2/docs/guide/jvmpi/jvmpi.html

thpreusser at 2007-7-1 23:53:55 > top of Java-index,Java HotSpot Virtual Machine,Specifications...