aicas logo Jamaica 3.4 release 8

com.aicas.jamaica.lang
Class Debug

java.lang.Object
  extended by com.aicas.jamaica.lang.Debug

public class Debug
extends Object

Debug provide Jamaica-specific debugging APIs.


Constructor Summary
Debug()
           
 
Method Summary
static void callInspector()
          Activate the Jamaica inspector if it is build in, do nothing otherwise.
static void dumpAllStacks()
          Print the stack trace of all used threads.
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()
          Print the current stack trace using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void dumpStackOf(Thread thread)
          Print 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 intialized and without memory allocation.
static void dumpThreadStates()
          Print the states of all running threads in the system.
static void forceTreeArrays(boolean b)
          Force the allocation of non-contignous arrays.
static int getDebugLevel()
          Request the current debug level.
static long getExecutionTime(Thread t)
          get 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 t)
          get 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 t)
          get 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 continuous memory block the 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 long getRawHighPrecisionTime()
          get raw high resolution time.
static int getThreadId(Thread thread)
          Return the JamaicaVM thread id for a given thread.
static long getTotalExecutionTime(Thread t)
          get 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 void native_print(String format, double d)
          output double using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void native_print(String format, float f)
          output float using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void native_print(String format, int i)
          output integer using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void native_print(String format, long l)
          output long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void native_println()
          output LF using a native function , i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(boolean b)
          Output a boolean value using a native method, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(char c)
           
static void print(char[] buffer, int offset, int length)
          Output subrange 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 intialized and without memory allocation.
static void print(double d)
          output double using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(float f)
          output float using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(int i)
          output integer using a native function i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(long l)
          output long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void print(String s)
          output string using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void printDebugGroups()
          Print the currently set Jamaica Debug Groups.
static void printhex(int i)
          output jex integer using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void printhex(long l)
          output hex long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void printhexln(int i)
          output jex integer followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void printhexln(long l)
          output hex long followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println()
          output LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(boolean b)
          Output a boolean followed by LF value using a native method, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(double d)
          output double followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(float f)
          output float followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(int i)
          output integer followed by LF using a native function i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(long l)
          output long followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void println(String s)
          output a string followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.
static void printlnTimeStamp(String message)
          Prints a time stamp with a message followed by a new line.
static void printStackTrace(Throwable throwable)
          Print the stack trace of the given Thorwable object using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized 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()
          Reset the collected profile data.
static void setDebugGroups(String groups)
          Set the Jamaica Debug Groups.
static void setDebugLevel(int level)
          Set the Jamaica DebugLevel.
static void showReachability(Class clazz)
          Show the reachability of all instances of a given class.
static void showReferencesToClass(Class clazz)
          Show references to all instances of a given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Debug

public Debug()
Method Detail

native_println

public static void native_println()
output LF using a native function , i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.


native_print

public static void native_print(String format,
                                int i)
output integer using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
format - C-print-format string
i - integer

native_print

public static void native_print(String format,
                                long l)
output long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
format - C-print-format string
l - long

native_print

public static void native_print(String format,
                                float f)
output float using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
format - C-print-format string
f - float

native_print

public static void native_print(String format,
                                double d)
output double using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
format - C-print-format string
d - double

print

public static void print(String s)
output string using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
s - string

println

public static void println()
output LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.


println

public static void println(String s)
output a string followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.


print

public static void print(char c)

print

public static void print(int i)
output integer using a native function i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
i - interger

println

public static void println(int i)
output integer followed by LF using a native function i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
i - interger

printhex

public static void printhex(int i)
output jex integer using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
i - interger

printhexln

public static void printhexln(int i)
output jex integer followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
i - interger

print

public static void print(long l)
output long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
l - long

println

public static void println(long l)
output long followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
l - long

printhex

public static void printhex(long l)
output hex long using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
l - long

printhexln

public static void printhexln(long l)
output hex long followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
l - long

print

public static void print(float f)
output float using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
f - float

println

public static void println(float f)
output float followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
f - float

print

public static void print(double d)
output double using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
d - double

println

public static void println(double d)
output double followed by LF using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
d - double

print

public static void print(boolean b)
Output a boolean value using a native method, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
b - the boolean to print

println

public static void println(boolean b)
Output a boolean followed by LF value using a native method, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
b - the boolean to print

print

public static void print(char[] buffer,
                         int offset,
                         int length)
Output subrange 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 intialized and without memory allocation.

Parameters:
buffer - the boolean to print
offset - the offset
length - the length

setDebugLevel

public static void setDebugLevel(int level)
Set the Jamaica DebugLevel. This is equivalent to setting the environment variable JAMAICA_DEBUGLEVEL for jamaicavmdb. In non-debugging mode, changing the debug level has no effect.

Parameters:
level - The new debugLevel.

getDebugLevel

public static int getDebugLevel()
Request the current debug level.

Returns:
the Jamaica DebugLevel. In jamaicavmdb, this can be set by the environment variable JAMAICA_DEBUGLEVEL or by setDebugLevel().

setDebugGroups

public static void setDebugGroups(String groups)
Set the Jamaica Debug Groups. This is equivalent to setting the environment variable JAMAICA_DEBUGGROUPS for jamaicavmdb. In non-debugging mode, changing the debug level has no effect.

Parameters:
groups - The debugging groups.

printDebugGroups

public static void printDebugGroups()
Print the currently set Jamaica Debug Groups.


printTimeStamp

public static void printTimeStamp(String message)
Prints a time stamp followed by the given message. The time stamp is in the form ssss.uuuuuu where ssss are the las for decimals of the seconds since start of the epoch and uuuuuu a mikroseconds.
NOTE: Since this method uses native stdio to print the message only ASCII characters might be printed properly.

Parameters:
message - The message to print.
See Also:
printlnTimeStamp(java.lang.String)

printlnTimeStamp

public static void printlnTimeStamp(String message)
Prints a time stamp with a message followed by a new line.

Parameters:
message - The message to print.
See Also:
printTimeStamp

printStackTrace

public static void printStackTrace(Throwable throwable)
Print the stack trace of the given Thorwable object using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.

Parameters:
throwable - the exception whose stack trace is to be printed.

dumpStack

public static void dumpStack()
Print the current stack trace using a native function, i.e., without requiring the VM and java.lang, java.io classes to be intialized and without memory allocation.


dumpAllStacks

public static void dumpAllStacks()
Print the stack trace of all used threads.

See Also:
dumpStackOf

dumpStackOf

public static void dumpStackOf(Thread thread)
Print 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 intialized and without memory allocation.

Parameters:
thread - the thread for which the stack should be printed. May be null to dump the Java stacks of all used threads.

showReachability

public static void showReachability(Class clazz)
Show the reachability of all instances of a given class. Print results to stderr. ATTENTION: 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. Furthermore, it relies on heuristics to determine the types of objects that are found and the system may crash if these heuristics turn out to be wrong. To put it short, this is solely for debugging purposes.

Parameters:
clazz - a class, if null this function has no effect.

showReferencesToClass

public static void showReferencesToClass(Class clazz)
Show references to all instances of a given class. This method is similar to showReachablility() as it uses GC reachability. But not every block is displayed in detail, only objects and fields are shown. ATTENTION: This function is inherently not real-time.

Parameters:
clazz - a class, if null this function has no effect.

printTracedAllocs

public static void printTracedAllocs()
Prints the traced allocations if TRACE_ALLOCS is defined. If "#define TRACE_ALLOCS" is used when building the libraries, this method prints out size information for strings, methods, constant pool etc. Otherwise ignored. For internal use only.


dumpProfileData

public static void dumpProfileData()
Dumps the collected profile data into the profile file. This clears the data as well. This is a NOP if profiling is not enabled.


dumpProfileData

public static void dumpProfileData(String filename)
Dumps the collected profile data into the given profile file. This clears the data as well. This is a NOP if profiling is not enabled.

Parameters:
filename - Local file name for the profile. If it is null, the default file name of the application is used.

dumpProfileDataViaNet

public static void dumpProfileDataViaNet(int port)
Dumps the collected profile data into the profile file. This clears the data as well. This is a NOP if profiling is not enabled.

Parameters:
port - the network port to which the profile is sent.

resetProfileData

public static void resetProfileData()
Reset the collected profile data. This is a NOP if profiling is not enabled.


getRawHighPrecisionTime

public static long getRawHighPrecisionTime()
get raw high resolution time.

Returns:
the execution time in CPU cycles, 0 on systems that don't permit access to CPU cycle counter.

getExecutionTime

public static long getExecutionTime(Thread t)
get 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).

Parameters:
t - the Java thread for which the execution time is to be returned.
Returns:
the execution time in CPU cycles, 0 on systems that don't permit access to CPU cycle counter or if the thread is not alive any more.

getTotalExecutionTime

public static long getTotalExecutionTime(Thread t)
get 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).

Parameters:
t - the Java thread for which the execution time is to be returned.
Returns:
the execution time in CPU cycles, 0 on systems that don't permit access to CPU cycle counter or if the thread is not alive any more.

getGarbageCollectionTime

public static long getGarbageCollectionTime(Thread t)
get 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).

Parameters:
t - the Java thread for which the garbage collection time is to be returned.
Returns:
the garbage collection time in CPU cycles, 0 on systems that don't permit access to CPU cycle counter or if the thread is not alive any more.

getInterpreterTime

public static long getInterpreterTime(Thread t)
get 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).

Parameters:
t - the Java thread for which the interpreter time is to be returned.
Returns:
the interpreter time in CPU cycles, 0 on systems that don't permit access to CPU cycle counter or if the thread is not alive any more.

getMaxFreeRangeSize

public static long getMaxFreeRangeSize()
Gets the size of the largest continuous memory block the can be allocated. (This is actually either the size of the first entry in the free list or the largest free memory range at the end of the last sweep phase.)

Returns:
largest allocatable memory block in bytes.

getNumberOfFreeRanges

public static int getNumberOfFreeRanges()
Gets the number of entries in the free list.
WARNING: This method has no real-time behaviour!

Returns:
number of entries in the free list.

getNumberOfBlocks

public static int getNumberOfBlocks()
Gets the number of blocks in the heap.

Returns:
number of blocks in the heap.

forceTreeArrays

public static void forceTreeArrays(boolean b)
Force the allocation of non-contignous arrays.


dumpThreadStates

public static void dumpThreadStates()
Print the states of all running threads in the system.


getThreadId

public static int getThreadId(Thread thread)
Return the JamaicaVM thread id for a given thread. The thread id is valid for running threads only, it is a unique value in the range 1..nativeGetThreadPoolSize().

Parameters:
thread - a Java thread instance, must not be null.
Returns:
the thread id, -1 if thread is not alive.

callInspector

public static void callInspector()
Activate the Jamaica inspector if it is build in, do nothing otherwise.


aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.