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

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

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)

Executes the given adb shell command, with simpleperf wrapped around

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

List<String> 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(List<String> arguList)

Set argument on simpleperf command

Protected methods

String commandStringPreparer(String command)

Public methods

executeCommand

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 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

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

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

List<String> getArgumentList ()

Get argument for simpleperf command

Returns
List<String> list of subcommand and arguments (nullable)

newInstance

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: SimplePerfUtil.SimplePerfType indicates which simpleperf mode
Returns
SimplePerfUtil a newly created SimplePerfUtil instance
Throws
NullPointerException

setArgumentList

void setArgumentList (List<String> arguList)

Set argument on simpleperf command

Parameters
arguList List: list of subcommand and arguments

Protected methods

commandStringPreparer

String commandStringPreparer (String command)

Parameters
command String
Returns
String