Package org.graalvm.tools.insight.heap
Class HeapDump.ThreadBuilder
java.lang.Object
org.graalvm.tools.insight.heap.HeapDump.ThreadBuilder
- Enclosing class:
HeapDump
Allows one to describe a state of a thread with local variables and record it in the
generated
HeapDump
.
HeapDump.InstanceBuilder mainBuilder = heap.newInstance(classMain);
final ObjectInstance main = mainBuilder.id();
mainBuilder.put("tom", tom).put("jerry", jerry);
ObjectInstance cathingThread = heap.newThread("Catching Jerry").
addStackFrame(classActor, "tom", "Actor.java", -1, jerry, tom, main).
addStackFrame(classMain, "main", "Main.java", -1, main).
dumpThread();
mainBuilder.put("thread", cathingThread).dumpInstance();
- Since:
- 21.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddStackFrame
(HeapDump.ClassInstance clazz, String methodName, String sourceFile, int lineNumber, HeapDump.ObjectInstance... locals) Adds aStackTraceElement
to the thread representation.Records the prepared thread information into theHeapDump
.
-
Method Details
-
addStackFrame
public HeapDump.ThreadBuilder addStackFrame(HeapDump.ClassInstance clazz, String methodName, String sourceFile, int lineNumber, HeapDump.ObjectInstance... locals) Adds aStackTraceElement
to the thread representation. Contains class/source location information as well as references to local variables.- Parameters:
clazz
- class for this framemethodName
- method for this framesourceFile
- path/location of a file for this framelineNumber
- line number for this framelocals
- array of references to local objects referenced from the frame- Returns:
this
builder- Since:
- 21.1
-
dumpThread
Records the prepared thread information into theHeapDump
.- Returns:
- object instance representing the
Thread
object in the heap - Throws:
UncheckedIOException
- when an I/O error occurs- Since:
- 21.1
-