SimplePerfUtil
public
class
SimplePerfUtil
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.SimplePerfUtil |
用于调度简单命令和收集结果的实用程序类
另见:
摘要
公共方法 | |
---|---|
SimplePerfResult
|
executeCommand(String command)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令 Simpleperf 结果将被解析并返回给调用方 |
void
|
executeCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令 调用方有责任通过接收器解析 simpleperf 结果 |
void
|
executeCommand(String command, IShellOutputReceiver receiver)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令 调用方有责任通过接收器解析 simpleperf 结果 |
|
getArgumentList()
获取 Simpleperf 命令的参数 |
static
SimplePerfUtil
|
newInstance(ITestDevice device, SimplePerfUtil.SimplePerfType type)
SimplePerfUtil 构造函数 调用方在初始化实例时必须定义设备和 Simpleperf 类型 |
void
|
setArgumentList(
在 simpleperf 命令中设置参数 |
受保护的方法 | |
---|---|
String
|
commandStringPreparer(String command)
|
公共方法
executeCommand
public SimplePerfResult executeCommand (String command)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令
Simpleperf 结果将被解析并返回给调用方
参数 | |
---|---|
command |
String :在设备上运行的命令 |
返回 | |
---|---|
SimplePerfResult |
SimplePerfResult 对象包含所有结果信息 |
抛出 | |
---|---|
DeviceNotAvailableException |
如果与设备的连接断开且无法恢复 |
executeCommand
public void executeCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令
调用方有责任通过接收器解析 simpleperf 结果
参数 | |
---|---|
command |
String :在设备上运行的命令 |
receiver |
IShellOutputReceiver :要将 shell 输出重定向到的 IShellOutputReceiver 对象 |
maxTimeToOutputShellResponse |
long :允许命令在多长时间内不输出任何响应;单位为 timeUnit 中指定的单位 |
timeUnit |
TimeUnit :maxTimeToOutputShellResponse 的时间单位,请参阅 ERROR(/TimeUnit) |
retryAttempts |
int :在命令因异常而失败时,最多可以重试的次数。如果执行 retryAttempts 未成功,系统会抛出 DeviceNotResponsiveException。 |
抛出 | |
---|---|
DeviceNotAvailableException |
如果与设备的连接断开且无法恢复 |
executeCommand
public void executeCommand (String command, IShellOutputReceiver receiver)
执行给定的 adb shell 命令,并用 simpleperf 封装该命令
调用方有责任通过接收器解析 simpleperf 结果
参数 | |
---|---|
command |
String :在设备上运行的命令 |
receiver |
IShellOutputReceiver :要将 shell 输出重定向到的 IShellOutputReceiver 对象 |
抛出 | |
---|---|
DeviceNotAvailableException |
如果与设备的连接断开且无法恢复 |
getArgumentList
publicgetArgumentList ()
获取 simpleperf 命令的参数
返回 | |
---|---|
|
子命令和参数的列表(可为 null) |
newInstance
public static SimplePerfUtil newInstance (ITestDevice device, SimplePerfUtil.SimplePerfType type)
SimplePerfUtil 构造函数
调用方在初始化实例时必须定义设备和 Simpleperf 类型
参数 | |
---|---|
device |
ITestDevice :ITestDevice 测试设备 |
type |
SimplePerfUtil.SimplePerfType :SimplePerfType 指示使用哪种 simpleperf 模式 |
返回 | |
---|---|
SimplePerfUtil |
新创建的 SimplePerfUtil 实例 |
setArgumentList
public void setArgumentList (arguList)
在 simpleperf 命令中设置参数
参数 | |
---|---|
arguList |
:子命令和参数的列表 |
受保护的方法
commandStringPreparer
protected String commandStringPreparer (String command)
参数 | |
---|---|
command |
String |
返回 | |
---|---|
String |