jvmti

Java JVMTI doesn't work alongside -Xdebug -Xrunjdwp

I spent the last 4 hours trying to set up Eclipse TPTP memory profiling on a Tomcat instance that must be run remotely (i.e. not in Eclipse). This should be possible according to the TPTP and Agent Controller docs. I installed the TPTP components (4.6.0) into my Eclipse (Galileo) workbench, along with the Agent Controller according to ...

Is there such as role as a Java Runtime Administrator?

There are Database Administrators (DBA) and Unix|Windows System Administrators. There are likely soon to be Cloud Administrators. There are hordes of "administrators" who are tasked with administering and managing numerous large-system JVMs running on/in various stacks, yet I've honestly met very few of them who have any real understan...

Infering number of bytecodes interpreted by Java runtime?

I'm trying to infer the number of bytecodes that the JVM "interprets"; In quotes because surely they are also compiled. Is there any way or JVMTI/JVMPI interface or instrumentation which can provide some sort of inferred metric on this? ...

Using JDWP and JVMTI to obtain information of the running Java application

We are developing an application for obtaining the information of a running java application using JDWP and JVMTI. Sun Java comes with a reference implementation of JDWP so using agentlib -jdwp: will use the reference implementation. Our aim is to study JVMTI and write JVMTI agents to get specific detail. Also creating a Front end using ...

Starting JVM Tool Interface agents in the VM during live phase

The JVM Tool Interface(JVMTI) specification says that the JVMTI agents can be started in the VM during live phase but they havent mentioned how it can be done. Has anyone tried this before or got any hints on how to do it? ...

Java: How do you really force a GC using JVMTI's ForceGargabeCollection?

I'm not looking for the usual "you can only hint the GC in Java using System.gc()" answers, this is not at all what this question is about. My questions is not subjective and is based on a reality: GC can be forced in Java for a fact. A lot of programs that we use daily do it: IntelliJ IDEA, NetBeans, VisualVM. They all can force GC t...

What are these threads which are spwaned when a Java application begins its execution?

I have created a simple Java application which has a JFrame and few JButtons. When I tried to inspect the java application using JVMTI I found that though I did not create any explicit threads there were lot of them spawned. I could find the following threads: DestroyJavaVM AWT-EventQueue-0 AWT-Shutdown AWT-XAWT- Daemon Thread Java...

creating a JVM from within a JNI method

Is it possible to create a JVM from within a JNI method using the JNI API? I've tried to do this using the JNI function "JNI_CreateJavaVM()", but it's not working (the function keeps returning a value less than zero). Here is the basic code I'm using (C++): JNIEnv *env; JavaVM *jvm; jint res; #ifdef JNI_VERSION_1_2 JavaVMInitArgs vm_...

JVMTI: FollowReferences : how to skip Soft/Weak/Phantom references?

I am writing a small code to detect number of objects left behind after certain actions in our tool. This uses FollowReferences() JVMTI-API. This counts instances reachable by all paths. How can I skip paths that included weak/soft/phantom reference? (IterateThroughHeap counts all objects at the moment, so the number is not fully r...

How to detect Java agents, JVMTI, etc...

How does one secure the Java environment when running on a machine you don't control? What is to stop someone from creating a java agent or native JVMTI agent and dumping bytecode or re-writing classes to bypass licensing and/or other security checks? Is there any way to detect if any agents are running from Java code? From JNI? From...

How to get parameter values in a MethodEntry callback

I have the following java code public class Test { public void sayHello(String msg) { System.out.println(msg); } } new Test().sayHello("Bonjour"); I have a jvmti agent attached to java where I catch function calls. I want to get parameter value which was passed to my method (e.g. "Bonjour") static void JNICALL c...

How to properly write a SIGPROF handler that invokes AsyncGetCallTrace?

I am writing a short and simple profiler (in C), which is intended to print out stack traces for threads in various Java clients at regular intervals. I have to use the undocumented function AsyncGetCallTrace instead of GetStackTrace to minimize intrusion and allow for stack traces regardless of thread state. The source code for the func...

Converting BCI (bytecode indices) to source code line numbers

I am writing JVMTI code to profile Java programs, which mostly entails obtaining stack traces from random threads at fixed time intervals using the function AsyncGetCallTrace. Thus, I am able to obtain CallTrace structures, each of which contains an array of CallFrame structures, which contain data about individual frames in a stack trac...