Added in API level 1
Deprecated in API level 23

Debug.InstructionCount


public static class Debug.InstructionCount
extends Object

java.lang.Object
   ↳ android.os.Debug.InstructionCount


This class was deprecated in API level 23.
Instruction counting is no longer supported.

API for gathering and querying instruction counts. Example usage:

   Debug.InstructionCount icount = new Debug.InstructionCount();
   icount.resetAndStart();
    [... do lots of stuff ...]
   if (icount.collect()) {
       System.out.println("Total instructions executed: "
           + icount.globalTotal());
       System.out.println("Method invocations: "
           + icount.globalMethodInvocations());
   }
 

Summary

Public constructors

InstructionCount()

Public methods

boolean collect()

Collect instruction counts.

int globalMethodInvocations()

Return the total number of method-invocation instructions executed globally.

int globalTotal()

Return the total number of instructions executed globally (i.e.

boolean resetAndStart()

Reset counters and ensure counts are running.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

InstructionCount

Added in API level 1
public InstructionCount ()

Public methods

collect

Added in API level 1
public boolean collect ()

Collect instruction counts. May or may not stop the counting process.

Returns
boolean

globalMethodInvocations

Added in API level 1
public int globalMethodInvocations ()

Return the total number of method-invocation instructions executed globally.

Returns
int

globalTotal

Added in API level 1
public int globalTotal ()

Return the total number of instructions executed globally (i.e. in all threads).

Returns
int

resetAndStart

Added in API level 1
public boolean resetAndStart ()

Reset counters and ensure counts are running. Counts may have already been running.

Returns
boolean true if counting was started