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
3
votes
1 answer

Using JVMTI to get the amount of memory freed by the GC

I'm trying to use JVMTI to know how much memory was freed by the GC, this would be used as part of a profiler. Using JVMTI I can get events for the GC_START and GC_END. JVMTI also provides facilities to walk over the heap and from that I can get its…
YairCarel
  • 82
  • 3
3
votes
1 answer

Does requesting a stack trace from a particular thread require all threads to be at a safe point?

When requesting the stack trace from another thread via Thread#getStackTrace() or ThreadMXBean#getThreadInfo(long[], int), do all threads have to enter a safe point and thus have to wait until all other threads have entered a safe point? This blog…
Felix
  • 5,804
  • 4
  • 25
  • 37
3
votes
1 answer

How does JFR manage to record stack trace, given it's promises of low-overhead?

Going through https://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-wp-2008279.pdf, I ran into the following quote: Most technologies used today to monitor, manage, and profile the Java runtime use fairly…
Elvir Crncevic
  • 525
  • 3
  • 17
3
votes
1 answer

Is there a way to enable "native method prefix" capabilities in a java language (non-native) JVM agent?

background: java has a mechanism for instrumenting native methods by basically allowing you to rename the native method with a set prefix and then create a method that delegates to it, in bytecode. It appears by default this is disallowed. Calling…
marathon
  • 7,881
  • 17
  • 74
  • 137
3
votes
1 answer

How to Get the values of method local variables and class variables using jvmti

I am trying to capture the variable values using JVMTI, when an exception event is generated, i went through the jvmti documentation and found that there are no functions which let me retrieve the values of the fields(variables), how can this be…
kumarD
  • 574
  • 2
  • 9
  • 23
3
votes
1 answer

JDI, Java Byte code instrumentation and Java agents (JWDP, JVMTI)

I am new in the realm of debuggers, instrumentation and JVMTI. So I have few questions about them. What is the difference between JDI(java debugger interface), JWDP, javaagent and native agent(JVMTI). and where does the java instrumentation API fit…
Rahul khandelwal
  • 331
  • 3
  • 14
3
votes
1 answer

How to do HotSwapping without using IDE?

I've used DCEVM hotswap technology in eclipse and IntelliJ IDE which was pretty cool feature. By using DCEVM in IDE what I can do is, I can change into the source code i.e add/remove/edit method, classes, properties at the runtime without doing…
Dhiren Hamal
  • 874
  • 1
  • 12
  • 31
3
votes
1 answer

JVMTI get local variable access capability on attach

I'm writing a native agent to java using the JVMTI libraries and trying to get the capability for accessing local variables. when loading the agent in the OnLoad phase that capability can be enabled, but when loading it in the live phase (OnAttach)…
stylo
  • 496
  • 4
  • 12
3
votes
1 answer

JVMTI profiling: calculating the amount of stack memory

I am working on a JVMTI agent that monitors memory usage of an application. I have managed to monitor memory allocations on the heap using bytecode instrumentation so that a native method gets invoked whenever a new object/array gets allocated. But…
P.M.
  • 98
  • 5
3
votes
2 answers

jvmti agent deadlock

When I run my jvmti agent with a java program, it seems that jvm encounters a deadlock. In my jvmti agent, I create a single raw monitor in Agent_OnLoad() and enter that lock at the beginning of every callback function and exit that lock at the end…
dzy
  • 81
  • 1
  • 4
2
votes
0 answers

How to map Java Thread to OS Thread on Linux?

I'm trying to map Java Thread to OS thread within JVMTI. In JVMTI, all I could grab is Java Thread object leveraging GetCurrentThread. But I want to know which OS thread this jthread is mapping to. I was told that there is a field in Hotspot, eetop,…
2
votes
1 answer

JVMTI agent crashes

I'm working on implementation of eraser data-race detection algorithm as JVMTI agent. When I try to run some example inputs to test my code, the JVM crashes, with dumps like the following (may show other stack traces for the same error as…
dkrikun
  • 1,228
  • 1
  • 15
  • 23
2
votes
1 answer

JVMTI equivalent for .NET

I am looking for some Microsoft API that whould have the same capabilities for monitoring .NET applications as JVMTI has for Java applications. For example, I'd like to be able to see every method call and the time it took (I am able to do that on…
Max
  • 105
  • 1
  • 1
  • 4
2
votes
1 answer

JVMTI get name of called Class/File

I tried to read through the whole jvmti documentation and I didn't find a solution for my problem. I want to get the name of the class/file that is used in the command line to call the program: java -agentpath: In…
Markus G.
  • 331
  • 1
  • 14
2
votes
1 answer

JVMTI class not prepared

I'm writing a native Java agent using JVMTI that goes over all the methods of all the loaded classes. Unfortunately many classes seem not yet prepared and therefore GetClassMethods returns JVMTI_ERROR_CLASS_NOT_PREPARED. I am registering a…
Philippe Marschall
  • 4,452
  • 1
  • 34
  • 52