java.lang.Object | |
↳ | dalvik.system.VMDebug |
Provides access to some 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
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_METHOD_TRACE_FILE_NAME | Specifies the default method trace data file name. | |||||||||
int | KIND_ALL_COUNTS | ||||||||||
int | KIND_GLOBAL_ALLOCATED_BYTES | ||||||||||
int | KIND_GLOBAL_ALLOCATED_OBJECTS | ||||||||||
int | KIND_GLOBAL_EXT_ALLOCATED_BYTES | ||||||||||
int | KIND_GLOBAL_EXT_ALLOCATED_OBJECTS | ||||||||||
int | KIND_GLOBAL_EXT_FREED_BYTES | ||||||||||
int | KIND_GLOBAL_EXT_FREED_OBJECTS | ||||||||||
int | KIND_GLOBAL_FREED_BYTES | ||||||||||
int | KIND_GLOBAL_FREED_OBJECTS | ||||||||||
int | KIND_GLOBAL_GC_INVOCATIONS | ||||||||||
int | KIND_THREAD_ALLOCATED_BYTES | ||||||||||
int | KIND_THREAD_ALLOCATED_OBJECTS | ||||||||||
int | KIND_THREAD_EXT_ALLOCATED_BYTES | ||||||||||
int | KIND_THREAD_EXT_ALLOCATED_OBJECTS | ||||||||||
int | KIND_THREAD_EXT_FREED_BYTES | ||||||||||
int | KIND_THREAD_EXT_FREED_OBJECTS | ||||||||||
int | KIND_THREAD_FREED_BYTES | ||||||||||
int | KIND_THREAD_FREED_OBJECTS | ||||||||||
int | KIND_THREAD_GC_INVOCATIONS | ||||||||||
int | TRACE_COUNT_ALLOCS | flag for startMethodTracing(), which adds the results from startAllocCounting to the trace key file. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Dump "hprof" data to the specified file.
| |||||||||||
Gets the number of loaded classes.
| |||||||||||
Determines if a debugger is currently attached.
| |||||||||||
Determines if debugging is enabled in this VM.
| |||||||||||
Returns the time since the last known debugger activity.
| |||||||||||
Dumps a list of loaded class to the log file.
| |||||||||||
Establishes an object allocation limit in the current thread.
| |||||||||||
Establishes an object allocation limit for the entire VM.
| |||||||||||
Count the number and aggregate size of memory allocations between
two points.
| |||||||||||
Starts sending Dalvik method trace info to the emulator.
| |||||||||||
Count the number of instructions executed between two points.
| |||||||||||
Start method tracing with default name, size, and with
0
flags. | |||||||||||
Start method tracing, specifying a file name as well as a default
buffer size.
| |||||||||||
Stops sending Dalvik method trace info to the emulator.
| |||||||||||
Stops method tracing.
| |||||||||||
Get an indication of thread CPU usage.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Specifies the default method trace data file name.
flag for startMethodTracing(), which adds the results from startAllocCounting to the trace key file.
Dump "hprof" data to the specified file. This will cause a GC. The VM may create a temporary file in the same directory.
fileName | Full pathname of output file (e.g. "/sdcard/dump.hprof"). |
---|
UnsupportedOperationException | if the VM was built without HPROF support. |
---|---|
IOException | if an error occurs while opening or writing files. |
Gets the number of loaded classes.
Determines if a debugger is currently attached.
Determines if debugging is enabled in this VM. If debugging is not enabled, a debugger cannot be attached.
Returns the time since the last known debugger activity.
Dumps a list of loaded class to the log file.
Establishes an object allocation limit in the current thread. Useful for catching regressions in code that is expected to operate without causing any allocations. The limit is valid from the return of this method until it is either changed or the thread terminates.
limit | the new limit. A value of 0 means not a single new object may be allocated. A value of -1 disables the limit. |
---|
Establishes an object allocation limit for the entire VM. Useful for catching regressions in code that is expected to operate without causing any allocations. The limit is valid from the return of this method until it is either changed or the thread terminates.
limit | the new limit. A value of 0 means not a single new object may be allocated. A value of -1 disables the limit. |
---|
Count the number and aggregate size of memory allocations between two points.
Starts sending Dalvik method trace info to the emulator.
Count the number of instructions executed between two points.
Start method tracing with default name, size, and with 0
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.
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. |
Stops sending Dalvik method trace info to the emulator.
Stops method tracing.
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.