Java – How to profile a JNI application using the Eclipse TPTP

eclipseeclipse-tptpjavajava-native-interfaceprofiling

I need to profile a java application launched by the JNI invocation API from a C application, and naturally the TPTP tools seemed like a good place to start. However, I can start the application, but I have no idea how to connect to it for profiling. I realize this falls into the 'dumb newbie' bucket, but I really am kind of lost. Permit me to explain:

I have added the JVM option "-XrunpiAgent:server=controlled" to my java VM startup options.

I have added $ECLIPSE_HOME/plugins/org.eclipse.tptp.platform.ac.linux_ia32_4.4.1.v200808290100/agent_controller/lib to my LD_LIBRARY_PATH

I am running against the Sun Java 1.5.0_10 JVM library

In Eclipse, I have a Java project that contains the code I wish to profile. I've got no profiling launch configurations, nor do I really know what needs to go into them.

It is at this point that my knowledge comes to an end; when I start my JNI-based application, it simply stops during VM startup and sits awaiting, presumably, an agent controller connection. What steps do I need to take to get this to happen, and to get information from it?

Best Answer

I have tried to used TPTP before and I never could set it up right. I could recommend to you that you try the profiler included with netbeans to connect to your application. I've used it to profile an Application with JNI calls and it served me well. Of course, all native code is opaque to the profiler and it only tells you how long the native calls themselves took.

I have a blog entry that explains how to profile Eclipse applications using netbeans, if it helps.