public class Debug extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Debug.FreeRangeStats
Statistics object created by
createFreeRangeStats() . |
Modifier and Type | Method and Description |
---|---|
static Debug.FreeRangeStats |
createFreeRangeStats()
Creates a new FreeRangeStats object.
|
static void |
dumpAllStacks()
Prints the stack trace of all used threads.
|
static void |
dumpHeapUse()
Dumps heap info to stderr.
|
static void |
dumpNativeStack()
Prints the native stack trace of the current thread.
|
static void |
dumpProfileData()
Dumps the collected profile data into the profile file.
|
static void |
dumpProfileData(String filename)
Dumps the collected profile data into the given profile file.
|
static void |
dumpProfileDataViaNet(int port)
Dumps the collected profile data into the profile file.
|
static void |
dumpStack()
Prints the current stack trace using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
dumpStackOf(Thread thread)
Prints the stack trace of the given thread using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
dumpThreadStates()
Prints the states of all running threads in the system.
|
static void |
forceTreeArrays(boolean b)
Forces the allocation of non-contiguous arrays.
|
static int |
getArrayDepth(Object a)
Obtains the depth of a given array.
|
static int |
getDebugLevel()
Gets the current debug level.
|
static long |
getExecutionTime(Thread thread)
Gets high resolution Java execution time of given thread (may
include the execution time of any non-java thread that preempted
this thread, does not include execution time of native JNI code).
|
static long |
getGarbageCollectionTime(Thread thread)
Gets high resolution execution time spent for garbage collection
work by given thread (may include the execution time of any
non-java thread that preempted this thread's garbage collection
activity).
|
static long |
getInterpreterTime(Thread thread)
Gets high resolution execution time spent by interpreted Java code
by given thread (may include the execution time of any non-java
thread that preempted this thread's interpreter activity).
|
static long |
getMaxFreeRangeSize()
Gets the size of the largest contiguous memory block that can be allocated.
|
static int |
getNumberOfBlocks()
Gets the number of blocks in the heap.
|
static int |
getNumberOfFreeRanges()
Gets the number of entries in the free list.
|
static Thread |
getOwner(Object monitor)
Determines the owner of a given Java monitor.
|
static long |
getStartTime()
Returns a time stamp taken during the startup of the VM, using the same
clock as
System.nanoTime() . |
static int |
getThreadId(Thread thread)
Returns the JamaicaVM thread id for a given thread.
|
static long |
getTotalExecutionTime(Thread thread)
Gets high resolution total execution time of given thread (may
include the execution time of any non-java thread that preempted
this thread or any thread that preempted this thread's native
code).
|
static boolean |
isTreeArray(Object a)
Checks if a given array is in non-contiguous tree representation.
|
static void |
native_print(String format,
double d)
Deprecated.
JamaicaVM 8.1.4, use
print(double) instead. |
static void |
native_print(String format,
float f)
Deprecated.
JamaicaVM 8.1.4, use
print(float) instead. |
static void |
native_print(String format,
int i)
Deprecated.
JamaicaVM 8.1.4, use
print(int) or
printhex(int) instead. |
static void |
native_print(String format,
long l)
Deprecated.
JamaicaVM 8.1.4, use
print(long) or
printhex(long) instead. |
static void |
native_println()
Deprecated.
JamaicaVM 8.1.4, use
println() instead. |
static void |
print(boolean b)
Prints a boolean value using a native method, i.e., without
requiring the VM and java.lang, java.io classes to be initialized
and without memory allocation.
|
static void |
print(char c)
Prints a character using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
print(char[] buffer,
int offset,
int length)
Prints the range offset..offset+length-1 of a char[] using a
native function, i.e., without requiring the VM and java.lang,
java.io classes to be initialized and without memory allocation.
|
static void |
print(double d)
Prints a double using a native function, i.e., without requiring the
VM and java.lang, java.io classes to be initialized and without
memory allocation.
|
static void |
print(float f)
Prints a float using a native function, i.e., without requiring the
VM and java.lang, java.io classes to be initialized and without
memory allocation.
|
static void |
print(int i)
Prints an integer using a native function i.e., without requiring
the VM and java.lang, java.io classes to be initialized and
without memory allocation.
|
static void |
print(long l)
Prints a long using a native function, i.e., without requiring the
VM and java.lang, java.io classes to be initialized and without
memory allocation.
|
static void |
print(String s)
Prints a string using a native function, i.e., without requiring the
VM and java.lang, java.io classes to be initialized and without
memory allocation.
|
static void |
printDebugGroups()
Prints the currently set Jamaica debug groups.
|
static void |
printFreeListStats()
Prints statistics of free memory blocks in heap (31 values) and
the size of the largest free memory block.
|
static void |
printhex(int i)
Prints an integer as hexadecimal using a native function, i.e., without
requiring the VM and java.lang, java.io classes to be initialized
and without memory allocation.
|
static void |
printhex(long l)
Prints a long as hexadecimal using a native function, i.e., without requiring
the VM and java.lang, java.io classes to be initialized and
without memory allocation.
|
static void |
printhexln(int i)
Prints an integer as hexadecimal followed by LF using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
printhexln(long l)
Prints a long as hexadecimal followed by LF using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
println()
Prints LF using a native function, i.e., without requiring the VM
and java.lang, java.io classes to be initialized and without
memory allocation.
|
static void |
println(boolean b)
Prints a boolean followed by LF value using a native method,
i.e., without requiring the VM and java.lang, java.io classes to
be initialized and without memory allocation.
|
static void |
println(double d)
Prints a double followed by LF using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
println(float f)
Prints a float followed by LF using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
println(int i)
Prints an integer followed by LF using a native function i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
println(long l)
Prints a long followed by LF using a native function, i.e., without
requiring the VM and java.lang, java.io classes to be initialized
and without memory allocation.
|
static void |
println(String s)
Prints a string followed by LF using a native function, i.e.,
without requiring the VM and java.lang, java.io classes to be
initialized and without memory allocation.
|
static void |
printlnTimeStamp(String message)
Prints a time stamp with a message followed by a new line.
|
static void |
printStackTrace()
Prints the stack trace of the current thread using a
native function, i.e., without requiring the VM and java.lang,
java.io classes to be initialized.
|
static void |
printStackTrace(Throwable throwable)
Prints the stack trace of the given Throwable object using a
native function, i.e., without requiring the VM and java.lang,
java.io classes to be initialized and without memory allocation.
|
static void |
printTimeStamp(String message)
Prints a time stamp followed by the given message.
|
static void |
printTracedAllocs()
Prints the traced allocations if TRACE_ALLOCS is defined.
|
static void |
resetProfileData()
Resets the collected profile data.
|
static void |
setDebugGroups(String groups)
Sets the Jamaica debug groups.
|
static void |
setDebugLevel(int level)
Set the Jamaica DebugLevel.
|
static void |
showReachability(Class clazz)
Shows the reachability of all instances of a given class.
|
static void |
showReferencesToClass(Class clazz)
Shows references to all instances of a given class.
|
static boolean |
traceEvent(int code,
String msg)
Inserts an event into a trace that is constructed by a runtime
monitoring tool provided by the OS.
|
static void |
verify(Class clazz)
Run classfile verifier on given class.
|
@Deprecated public static void native_println()
println()
instead.@Deprecated public static void native_print(String format, int i)
print(int)
or
printhex(int)
instead.format
- C-print-format stringi
- integer@Deprecated public static void native_print(String format, long l)
print(long)
or
printhex(long)
instead.format
- C-print-format stringl
- long@Deprecated public static void native_print(String format, float f)
print(float)
instead.format
- C-print-format stringf
- float@Deprecated public static void native_print(String format, double d)
print(double)
instead.format
- C-print-format stringd
- doublepublic static void print(String s)
s
- the stringpublic static void println()
public static void println(String s)
s
- the stringpublic static void print(char c)
c
- the characterpublic static void print(int i)
i
- the integerpublic static void println(int i)
i
- the integerpublic static void printhex(int i)
i
- the integerpublic static void printhexln(int i)
i
- the integerpublic static void print(long l)
l
- the longpublic static void println(long l)
l
- the longpublic static void printhex(long l)
l
- the longpublic static void printhexln(long l)
l
- the longpublic static void print(float f)
f
- the floatpublic static void println(float f)
f
- the floatpublic static void print(double d)
d
- the doublepublic static void println(double d)
d
- the doublepublic static void print(boolean b)
b
- the booleanpublic static void println(boolean b)
b
- the booleanpublic static void print(char[] buffer, int offset, int length)
buffer
- the char-array to print fromoffset
- the buffer index where to start printinglength
- the number of chars to be printedpublic static void setDebugLevel(int level)
level
- the new debugLevelpublic static int getDebugLevel()
public static void setDebugGroups(String groups)
groups
- the debug groupspublic static void printDebugGroups()
public static void printTimeStamp(String message)
Since this method uses native stdio to print the message only ASCII characters are guaranteed to be printed correctly.
message
- the message to printprintlnTimeStamp(java.lang.String)
public static void printlnTimeStamp(String message)
message
- the message to printprintTimeStamp(java.lang.String)
public static void printStackTrace()
public static void printStackTrace(Throwable throwable)
throwable
- the exception whose stack trace is to be printedpublic static void dumpStack()
public static void dumpAllStacks()
dumpStackOf(java.lang.Thread)
public static void dumpStackOf(Thread thread)
thread
- the thread for which the stack should be printed;
may be null to dump the Java stacks of all used threadspublic static void dumpNativeStack()
public static void showReachability(Class clazz)
This function is inherently not real-time. It uses malloc() for a large temporary buffer, it blocks the VM completely while determining and printing the reachability information.
This is method is only intended for debugging, not for use in production.
clazz
- a class, if null this function has no effectpublic static void showReferencesToClass(Class clazz)
This function is inherently not real-time.
clazz
- a class, if null this function has no effect.public static void dumpHeapUse()
This function is inherently not real-time. It uses malloc() for a large temporary buffer, it blocks the VM completely while determining and printing heap use information.
This is method is only intended for debugging, not for use in production.
public static void printTracedAllocs()
If #define TRACE_ALLOCS is used when building the libraries, this method prints size information for strings, methods, constant pool etc. Otherwise ignored. For internal use only.
public static void dumpProfileData()
This is a NOP if profiling is not enabled.
public static void dumpProfileData(String filename)
This is a NOP if profiling is not enabled.
filename
- local file name for the profile; if null,
the default file name of the application is usedpublic static void dumpProfileDataViaNet(int port)
This is a NOP if profiling is not enabled.
port
- the network port to which the profile is sentpublic static void resetProfileData()
This is a NOP if profiling is not enabled.
public static long getExecutionTime(Thread thread)
thread
- the Java thread for which the execution time is to be
returnedpublic static long getTotalExecutionTime(Thread thread)
thread
- the Java thread for which the execution time is to be
returnedpublic static long getGarbageCollectionTime(Thread thread)
thread
- the Java thread for which the garbage collection time is
to be returnedpublic static long getInterpreterTime(Thread thread)
thread
- the Java thread for which the interpreter time is to be
returnedpublic static long getMaxFreeRangeSize()
public static int getNumberOfFreeRanges()
This method has no real-time behaviour!
public static void printFreeListStats()
Note: This method breaks all other real-time code behavior, it blocks the VM for the free list scan!
public static Debug.FreeRangeStats createFreeRangeStats()
public static int getNumberOfBlocks()
public static void forceTreeArrays(boolean b)
b
- boolean to enable/disable contiguous array allocationpublic static int getArrayDepth(Object a)
NullPointerException
- if a is nullIllegalArgumentException
- if a is neither a primitive nor
an object arraya
- an array, either of reference type or of any primitive
typepublic static boolean isTreeArray(Object a)
NullPointerException
- if a is nullIllegalArgumentException
- if a is neither a primitive nor
an object arraya
- an array, either of reference type or of any primitive
typepublic static void dumpThreadStates()
public static int getThreadId(Thread thread)
thread
- a Java thread instance, must not be nullpublic static Thread getOwner(Object monitor)
NullPointerException
- if monitor is nullInternalError
- if the owner thread of the monitor has
terminated without exiting the monitor. Note that this error may
not occur if the terminated thread is reused by a newly started
Java thread.monitor
- the Java monitorpublic static void verify(Class clazz)
VerifyError
- in case classfile verification failedclazz
- the class to be verified.public static long getStartTime()
System.nanoTime()
.public static boolean traceEvent(int code, String msg)
code
- a numeric code for this eventmsg
- a string that is associated with this eventaicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.