Android Guides | Samples

Android.OS.Debug Class

Provides various debugging methods for Android applications, including tracing and allocation counts.

See Also: Debug

Syntax

[Android.Runtime.Register("android/os/Debug", DoNotGenerateAcw=true)]
public sealed class Debug : Object

Remarks

Provides various debugging methods for Android applications, including tracing and allocation counts.

Logging Trace Files

Debug can create log files that give details about an application, such as a call stack and start/stop times for any running methods. See Traceview: A Graphical Log Viewer for information about reading trace files. To start logging trace files, call one of the startMethodTracing() methods. To stop tracing, call Debug.StopMethodTracing.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.OS.Debug are listed below.

See Also: Object

Public Fields

const
ShowClassloaderDebugShow (2).
const
ShowFullDetailDebugShow (1). Flags for printLoadedClasses().
const
ShowInitializedDebugShow (4).
const
TraceCountAllocsDebugTraceOptions (1). Flags for startMethodTracing().

Public Properties

[read-only]
static
BinderDeathObjectCountInt32. Returns the number of death notification links to Binder objects that exist in the current process.
[read-only]
static
BinderLocalObjectCountInt32. Returns the number of active local Binder objects that exist in the current process.
[read-only]
static
BinderProxyObjectCountInt32. Returns the number of references to remote proxy Binder objects that exist in the current process.
[read-only]
static
BinderReceivedTransactionsInt32. Returns the number of received transactions from the binder driver.
[read-only]
static
BinderSentTransactionsInt32. Returns the number of sent transactions from this process.
[read-only]
static
GlobalAllocCountInt32. Returns the global count of objects allocated by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalAllocSizeInt32. Returns the global size, in bytes, of objects allocated by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalClassInitCountInt32. Returns the number of classes successfully initialized (ie those that executed without throwing an exception) between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalClassInitTimeInt32. Returns the time spent successfully initializing classes between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalExternalAllocCountInt32. This method exists for compatibility and always returns 0.
[read-only]
static
GlobalExternalAllocSizeInt32. This method exists for compatibility and always returns 0.
[read-only]
static
GlobalExternalFreedCountInt32. This method exists for compatibility and always returns 0.
[read-only]
static
GlobalExternalFreedSizeInt32. This method exists for compatibility and has no effect.
[read-only]
static
GlobalFreedCountInt32. Returns the global count of objects freed by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalFreedSizeInt32. Returns the global size, in bytes, of objects freed by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
GlobalGcInvocationCountInt32. Returns the number of non-concurrent GC invocations between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
IsDebuggerConnectedBoolean. Determine if a debugger is currently attached.
[read-only]
static
LoadedClassCountInt32. Get the number of loaded classes.
[read-only]
static
NativeHeapAllocatedSizeInt64. Returns the amount of allocated memory in the native heap.
[read-only]
static
NativeHeapFreeSizeInt64. Returns the amount of free memory in the native heap.
[read-only]
static
NativeHeapSizeInt64. Returns the size of the native heap.
[read-only]
static
PssInt64. Retrieves the PSS memory used by the process as given by the smaps.
[read-only]
static
ThreadAllocCountInt32. Returns the thread-local count of objects allocated by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
ThreadAllocSizeInt32. Returns the thread-local size of objects allocated by the runtime between a Debug.StartAllocCounting and Debug.StopAllocCounting.
[read-only]
static
ThreadExternalAllocCountInt32. This method exists for compatibility and has no effect.
[read-only]
static
ThreadExternalAllocSizeInt32. This method exists for compatibility and has no effect.
[read-only]
static
ThreadGcInvocationCountInt32. Returns the number of thread-local non-concurrent GC invocations between a Debug.StartAllocCounting and Debug.StopAllocCounting.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

static
ChangeDebugPort(Int32)
Change the JDWP port.
static
DumpHprofData(String)
Dump "hprof" data to the specified file.
static
DumpHprofDataAsync(String) : Task
static
DumpService(String, FileDescriptor, String[]) : Boolean
Get a debugging dump of a system service by name.
static
DumpServiceAsync(String, FileDescriptor, String[]) : System.Threading.Tasks.Task<bool>
static
EnableEmulatorTraceOutput()
Enable "emulator traces", in which information about the current method is made available to the "emulator -trace" feature.
static
GetMemoryInfo(Debug+MemoryInfo)
Retrieves information about this processes memory usages.
static
PrintLoadedClasses(DebugShow)
Dump a list of all currently loaded class to the log file.
static
ResetAllCounts()
Clears all the global and thread-local memory allocation counters.
static
ResetGlobalAllocCount()
Clears the global count of objects allocated.
static
ResetGlobalAllocSize()
Clears the global size of objects allocated.
static
ResetGlobalClassInitCount()
Clears the count of classes initialized.
static
ResetGlobalClassInitTime()
Clears the count of time spent initializing classes.
static
ResetGlobalExternalAllocCount()
This method exists for compatibility and has no effect.
static
ResetGlobalExternalAllocSize()
This method exists for compatibility and has no effect.
static
ResetGlobalExternalFreedCount()
This method exists for compatibility and has no effect.
static
ResetGlobalExternalFreedSize()
This method exists for compatibility and has no effect.
static
ResetGlobalFreedCount()
Clears the global count of objects freed.
static
ResetGlobalFreedSize()
Clears the global size of objects freed.
static
ResetGlobalGcInvocationCount()
Clears the count of non-concurrent GC invocations.
static
ResetThreadAllocCount()
Clears the thread-local count of objects allocated.
static
ResetThreadAllocSize()
Clears the thread-local count of objects allocated.
static
ResetThreadExternalAllocCount()
This method exists for compatibility and has no effect.
static
ResetThreadExternalAllocSize()
This method exists for compatibility and has no effect.
static
ResetThreadGcInvocationCount()
Clears the thread-local count of non-concurrent GC invocations.
static
SetAllocationLimit(Int32) : Int32
Establish an object allocation limit in the current thread.
static
SetGlobalAllocationLimit(Int32) : Int32
Establish a global object allocation limit.
static
StartAllocCounting()
Start counting the number and aggregate size of memory allocations.
static
StartMethodTracing()
Start method tracing with default log name and buffer size.
static
StartMethodTracing(String)
Start method tracing, specifying the trace log file name.
static
StartMethodTracing(String, Int32)
Start method tracing, specifying the trace log file name and the buffer size.
static
StartMethodTracing(String, Int32, DebugTraceOptions)
Start method tracing, specifying the trace log file name and the buffer size.
static
StartMethodTracingSampling(String, Int32, Int32)
Start sampling-based method tracing, specifying the trace log file name, the buffer size, and the sampling interval.
static
StartNativeTracing()
Enable qemu tracing.
static
StopAllocCounting()
Stop counting the number and aggregate size of memory allocations.
static
StopMethodTracing()
Stop method tracing.
static
StopNativeTracing()
Stop qemu tracing.
static
ThreadCpuTimeNanos() : Int64
Get an indication of thread CPU usage.
static
WaitForDebugger()
Wait until a debugger attaches.
static
WaitingForDebugger() : Boolean
Returns "true" if one or more threads is waiting for a debugger to attach.