Build 1.0_r1(from source)

dalvik.system
Class VMDebug

java.lang.Object
  extended by dalvik.system.VMDebug

public final class VMDebug
extends Object

VM-specific debug features. Though this class and many of its members are public, this class is meant to be wrapped in a more friendly way for use by application developers. On the Android platform, the recommended way to access this functionality is through the class android.os.Debug.


Field Summary
static String DEFAULT_METHOD_TRACE_FILE_NAME
          default method trace data file name
static int KIND_ALL_COUNTS
           
static int KIND_GLOBAL_ALLOCATED_BYTES
           
static int KIND_GLOBAL_ALLOCATED_OBJECTS
           
static int KIND_GLOBAL_EXT_ALLOCATED_BYTES
           
static int KIND_GLOBAL_EXT_ALLOCATED_OBJECTS
           
static int KIND_GLOBAL_EXT_FREED_BYTES
           
static int KIND_GLOBAL_EXT_FREED_OBJECTS
           
static int KIND_GLOBAL_FREED_BYTES
           
static int KIND_GLOBAL_FREED_OBJECTS
           
static int KIND_GLOBAL_GC_INVOCATIONS
           
static int KIND_THREAD_ALLOCATED_BYTES
           
static int KIND_THREAD_ALLOCATED_OBJECTS
           
static int KIND_THREAD_EXT_ALLOCATED_BYTES
           
static int KIND_THREAD_EXT_ALLOCATED_OBJECTS
           
static int KIND_THREAD_EXT_FREED_BYTES
           
static int KIND_THREAD_EXT_FREED_OBJECTS
           
static int KIND_THREAD_FREED_BYTES
           
static int KIND_THREAD_FREED_OBJECTS
           
static int KIND_THREAD_GC_INVOCATIONS
           
static int TRACE_COUNT_ALLOCS
          flag for startMethodTracing(), which adds the results from startAllocCounting to the trace key file.
 
Method Summary
static int getAllocCount(int kind)
           
static void getInstructionCount(int[] counts)
           
static int getLoadedClassCount()
          Get the number of loaded classes.
static boolean isDebuggerConnected()
          Determine if a debugger is currently attached.
static long lastDebuggerActivity()
          Time, in msec, since the last debugger activity.
static void printLoadedClasses(int flags)
          Dump a list of loaded class to the log file.
(package private) static void printThis(Object thisThing, int count, int thing)
           
static void resetAllocCount(int kinds)
           
static void resetInstructionCount()
           
static int setAllocationLimit(int limit)
          Establish an object allocation limit in the current thread.
static int setGlobalAllocationLimit(int limit)
          Establish an object allocation limit for the entire VM.
static void startAllocCounting()
          Count the number and aggregate size of memory allocations between two points.
static void startEmulatorTracing()
          Start sending Dalvik method trace info to the emulator.
static void startInstructionCounting()
          Count the number of instructions executed between two points.
static void startMethodTracing()
          Start method tracing with default name, size, and with 0 flags.
static void startMethodTracing(String traceFileName, int bufferSize, int flags)
          Start method tracing, specifying a file name as well as a default buffer size.
static void stopAllocCounting()
           
static void stopEmulatorTracing()
          Stop sending Dalvik method trace info to the emulator.
static void stopInstructionCounting()
           
static void stopMethodTracing()
          Stop method tracing.
static long threadCpuTimeNanos()
          Get an indication of thread CPU usage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_METHOD_TRACE_FILE_NAME

public static final String DEFAULT_METHOD_TRACE_FILE_NAME
default method trace data file name

See Also:
Constant Field Values

TRACE_COUNT_ALLOCS

public static final int TRACE_COUNT_ALLOCS
flag for startMethodTracing(), which adds the results from startAllocCounting to the trace key file.

See Also:
Constant Field Values

KIND_GLOBAL_ALLOCATED_OBJECTS

public static final int KIND_GLOBAL_ALLOCATED_OBJECTS
See Also:
Constant Field Values

KIND_GLOBAL_ALLOCATED_BYTES

public static final int KIND_GLOBAL_ALLOCATED_BYTES
See Also:
Constant Field Values

KIND_GLOBAL_FREED_OBJECTS

public static final int KIND_GLOBAL_FREED_OBJECTS
See Also:
Constant Field Values

KIND_GLOBAL_FREED_BYTES

public static final int KIND_GLOBAL_FREED_BYTES
See Also:
Constant Field Values

KIND_GLOBAL_GC_INVOCATIONS

public static final int KIND_GLOBAL_GC_INVOCATIONS
See Also:
Constant Field Values

KIND_GLOBAL_EXT_ALLOCATED_OBJECTS

public static final int KIND_GLOBAL_EXT_ALLOCATED_OBJECTS
See Also:
Constant Field Values

KIND_GLOBAL_EXT_ALLOCATED_BYTES

public static final int KIND_GLOBAL_EXT_ALLOCATED_BYTES
See Also:
Constant Field Values

KIND_GLOBAL_EXT_FREED_OBJECTS

public static final int KIND_GLOBAL_EXT_FREED_OBJECTS
See Also:
Constant Field Values

KIND_GLOBAL_EXT_FREED_BYTES

public static final int KIND_GLOBAL_EXT_FREED_BYTES
See Also:
Constant Field Values

KIND_THREAD_ALLOCATED_OBJECTS

public static final int KIND_THREAD_ALLOCATED_OBJECTS
See Also:
Constant Field Values

KIND_THREAD_ALLOCATED_BYTES

public static final int KIND_THREAD_ALLOCATED_BYTES
See Also:
Constant Field Values

KIND_THREAD_FREED_OBJECTS

public static final int KIND_THREAD_FREED_OBJECTS
See Also:
Constant Field Values

KIND_THREAD_FREED_BYTES

public static final int KIND_THREAD_FREED_BYTES
See Also:
Constant Field Values

KIND_THREAD_GC_INVOCATIONS

public static final int KIND_THREAD_GC_INVOCATIONS
See Also:
Constant Field Values

KIND_THREAD_EXT_ALLOCATED_OBJECTS

public static final int KIND_THREAD_EXT_ALLOCATED_OBJECTS
See Also:
Constant Field Values

KIND_THREAD_EXT_ALLOCATED_BYTES

public static final int KIND_THREAD_EXT_ALLOCATED_BYTES
See Also:
Constant Field Values

KIND_THREAD_EXT_FREED_OBJECTS

public static final int KIND_THREAD_EXT_FREED_OBJECTS
See Also:
Constant Field Values

KIND_THREAD_EXT_FREED_BYTES

public static final int KIND_THREAD_EXT_FREED_BYTES
See Also:
Constant Field Values

KIND_ALL_COUNTS

public static final int KIND_ALL_COUNTS
See Also:
Constant Field Values
Method Detail

lastDebuggerActivity

public static long lastDebuggerActivity()
Time, in msec, since the last debugger activity. -1 if debugger is not connected.


isDebuggerConnected

public static boolean isDebuggerConnected()
Determine if a debugger is currently attached.


startMethodTracing

public static void startMethodTracing()
Start method tracing with default name, size, and with 0 flags.


startMethodTracing

public static void startMethodTracing(String traceFileName,
                                      int bufferSize,
                                      int flags)
Start method tracing, specifying a file name as well as a default buffer size. See Running the Traceview Debugging Program for information about reading trace files.

You can use either a fully qualified path and name, or just a name. If only a name is specified, the file will be created under the /sdcard/ directory. If a name is not given, the default is /sdcard/dmtrace.trace.

Parameters:
traceFileName - name to give the trace file
bufferSize - the maximum size of both files combined. If passed as 0, it defaults to 8MB.
flags - flags to control method tracing. The only one that is currently defined is TRACE_COUNT_ALLOCS.

stopMethodTracing

public static void stopMethodTracing()
Stop method tracing.


startEmulatorTracing

public static void startEmulatorTracing()
Start sending Dalvik method trace info to the emulator.


stopEmulatorTracing

public static void stopEmulatorTracing()
Stop sending Dalvik method trace info to the emulator.


threadCpuTimeNanos

public static long threadCpuTimeNanos()
Get an indication of thread CPU usage. The value returned indicates the amount of time that the current thread has spent executing code or waiting for certain types of I/O. The time is expressed in nanoseconds, and is only meaningful when compared to the result from an earlier call. Note that nanosecond resolution does not imply nanosecond accuracy. On system which don't support this operation, the call returns -1.


startAllocCounting

public static void startAllocCounting()
Count the number and aggregate size of memory allocations between two points.


stopAllocCounting

public static void stopAllocCounting()

getAllocCount

public static int getAllocCount(int kind)

resetAllocCount

public static void resetAllocCount(int kinds)

setAllocationLimit

public static int setAllocationLimit(int limit)
Establish an object allocation limit in the current thread. Useful for catching regressions in code that is expected to operate without causing any allocations. Use -1 to disable the limit. Returns the previous limit.


setGlobalAllocationLimit

public static int setGlobalAllocationLimit(int limit)
Establish an object allocation limit for the entire VM. Very much like setAllocationLimit(). Use -1 to disable the limit. Returns the previous limit.


startInstructionCounting

public static void startInstructionCounting()
Count the number of instructions executed between two points.


stopInstructionCounting

public static void stopInstructionCounting()

getInstructionCount

public static void getInstructionCount(int[] counts)

resetInstructionCount

public static void resetInstructionCount()

printLoadedClasses

public static void printLoadedClasses(int flags)
Dump a list of loaded class to the log file.


getLoadedClassCount

public static int getLoadedClassCount()
Get the number of loaded classes.


printThis

static void printThis(Object thisThing,
                      int count,
                      int thing)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature