SimplePerfUtil

public class SimplePerfUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.SimplePerfUtil


Utility class to dispatch simple command and collect results

Summary

Nested classes

enum SimplePerfUtil.SimplePerfType

Enum of simpleperf command options  

Public methods

SimplePerfResult executeCommand(String command)

Executes the given adb shell command, with simpleperf wrapped around

Simpleperf result will be parsed and return to caller

void executeCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

Executes the given adb shell command, with simpleperf wrapped around

It is caller's responsibility to parse simpleperf result through receiver

void executeCommand(String command, IShellOutputReceiver receiver)

Executes the given adb shell command, with simpleperf wrapped around

It is caller's responsibility to parse simpleperf result through receiver

getArgumentList()

Get argument for simpleperf command

static SimplePerfUtil newInstance(ITestDevice device, SimplePerfUtil.SimplePerfType type)

SimplePerfUtil Constructor

Caller must define device and simpleperf type when initializing instance

void setArgumentList( arguList)

Set argument on simpleperf command

Protected methods

String commandStringPreparer(String command)

Public methods

executeCommand

public SimplePerfResult executeCommand (String command)

Executes the given adb shell command, with simpleperf wrapped around

Simpleperf result will be parsed and return to caller

Parameters
command String: command to run on device

Returns
SimplePerfResult SimplePerfResult object contains all result information

Throws
DeviceNotAvailableException if connection with device is lost and cannot be recovered

executeCommand

public void executeCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes the given adb shell command, with simpleperf wrapped around

It is caller's responsibility to parse simpleperf result through receiver

Parameters
command String: command to run on device

receiver IShellOutputReceiver: IShellOutputReceiver object to direct shell output to

maxTimeToOutputShellResponse long: the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit

timeUnit TimeUnit: timeUnit unit for maxTimeToOutputShellResponse, see ERROR(/TimeUnit)

retryAttempts int: the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

Throws
DeviceNotAvailableException if connection with device is lost and cannot be recovered

executeCommand

public void executeCommand (String command, 
                IShellOutputReceiver receiver)

Executes the given adb shell command, with simpleperf wrapped around

It is caller's responsibility to parse simpleperf result through receiver

Parameters
command String: command to run on device

receiver IShellOutputReceiver: IShellOutputReceiver object to direct shell output to

Throws
DeviceNotAvailableException if connection with device is lost and cannot be recovered

getArgumentList

public  getArgumentList ()

Get argument for simpleperf command

Returns
list of subcommand and arguments (nullable)

newInstance

public static SimplePerfUtil newInstance (ITestDevice device, 
                SimplePerfUtil.SimplePerfType type)

SimplePerfUtil Constructor

Caller must define device and simpleperf type when initializing instance

Parameters
device ITestDevice: ITestDevice test device

type SimplePerfUtil.SimplePerfType: SimplePerfType indicates which simpleperf mode

Returns
SimplePerfUtil a newly created SimplePerfUtil instance

setArgumentList

public void setArgumentList ( arguList)

Set argument on simpleperf command

Parameters
arguList : list of subcommand and arguments

Protected methods

commandStringPreparer

protected String commandStringPreparer (String command)

Parameters
command String

Returns
String