Questions tagged [jvmti]

JVMTI is the Java Virtual Machine Tool Interface, a native API by which authors can write JVM plugins to monitor or modify the execution of a Java Virtual Machine.

Documentation for the current JVMTI 1.2. Home page for JVMTI in JDK 7.

JVMTI was introduced in JDK 5. It replaces Java Virtual Machine Profiler Interface (JVMPI) and the Java Virtual Machine Debug Interface (JVMDI).

214 questions
24
votes
4 answers

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…
SyntaxT3rr0r
  • 27,745
  • 21
  • 87
  • 120
15
votes
6 answers

Java API on top of JVMTI?

Is there a nice Java API I can use on top of JVMTI?
yazz.com
  • 57,320
  • 66
  • 234
  • 385
13
votes
2 answers

AttachNotSupportedException due to missing java_pid file in Attach API

Building a profiler of my own, I use the JVMTI API to build a native library agent. This agent can be started together with the JVM by using the addition parameter -agentlib. In addition there is the Attach API which allows to inject an agent into a…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
13
votes
3 answers

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…
Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
11
votes
2 answers

notifyAll() number of invocations difference while profiling

I have implemented a simple profiler with JVMTI to display the invocation on wait() and notifyAll(). As a test case I am using the. producer consumer example of Oracle. I have the following three events: notifyAll() is invoked wait() is…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
10
votes
2 answers

Unloading a JVMTI agent at runtime?

I'm using the attach API to load a JVMTI agent at runtime. I'd like to unload the JVMTI agent when my program is done without terminating the JVM the agent is loaded in. According to this documentation there is no way to do this from the attach API.…
Jared
  • 39,513
  • 29
  • 110
  • 145
9
votes
1 answer

How to retransform an executing method with JVMTI agent which has no further invocations?

I am instrumenting a class file during runtime for various purposes. I'm using a JVMTI agent to that end. My strategy to instrument a method is to call RetransformClasses function to invoke ClassFileLoadHook. This strategy works fine for all the…
Saqib Ahmed
  • 1,056
  • 14
  • 33
8
votes
2 answers

Can I programmatically find out in which GC generation an instance lives?

This question is limited in scope to HotSpot generations. Is there any way to programmatically find out in which generation a particular instance lives. Data such as: Young or old generation? If young, which survivor space? Inside TLAB? Which…
Brian Harris
  • 2,735
  • 3
  • 22
  • 34
8
votes
4 answers

Is there a way to generate a periodic java thread dump using JVMTI?

There are multiple ways to generate thread dumps in java. I'd like to use JVMTI (the C API) to generate it, in order to evaluate its performance impact on a running JVM. (I am aware of jstack and JMX ; this question is not generally about getting…
Ovesh
  • 5,209
  • 11
  • 53
  • 73
8
votes
1 answer

DebuggerStepThrough equivalent for Java

.NET has a couple of handy annotations that instruct a debugger to step through/over certain methods. I would like to know if there is an equivalent that works on the Java platform. For instance: @DebuggerStepThrough public void foo() { …
Iulian Dragos
  • 5,692
  • 23
  • 31
7
votes
3 answers

How can JVMTI agent set a JVM flag on startup?

In order to support better profiling data I would like my JVMTI agent to enable a couple of JVM flags. The agent in question is Honest-Profiler and it is can only be loaded at startup. I would like to enable the flags: -XX:+UnlockDiagnosticVMOptions…
Nitsan Wakart
  • 2,841
  • 22
  • 27
7
votes
1 answer

Adding invokestatic to java/lang/Object. via JVM TI agent causes JVM to crash with segfault

I am trying to track allocations of all objects in JVM. In the several documents about allocation profilers it was mentioned that the easiest way to do so is this: add invokestatic Tracker.trackAllocation()V instruction to java/lang/Object.
Korobochka
  • 137
  • 2
  • 5
7
votes
1 answer

Can javac supply a class' "source debug extension information" attribute?

A Java class file format supports an attribute called "source debug extension" (see Java language specification §4.7.11 "TheSourceDebugExtension attribute"). In JVMs that support this aspect of JVMTI, you can query for this string using jvmtiError…
0xbe5077ed
  • 4,565
  • 6
  • 35
  • 77
7
votes
2 answers

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…
DR.
  • 71
  • 1
  • 2
7
votes
2 answers

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…
MohamedSanaulla
  • 6,112
  • 5
  • 28
  • 45
1
2 3
14 15