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

在 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 TimeUnitmaxTimeToOutputShellResponse 的 timeUnit 单位,请参阅 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

public  getArgumentList ()

获取 simpleperf 命令的实参

返回
子命令和实参的列表(可为 null)

newInstance

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

SimplePerfUtil 构造函数

调用方在初始化实例时必须定义设备和 simpleperf 类型

参数
device ITestDeviceITestDevice 测试设备

type SimplePerfUtil.SimplePerfTypeSimplePerfType 表示 simpleperf 模式

返回
SimplePerfUtil 新创建的 SimplePerfUtil 实例

setArgumentList

public void setArgumentList ( arguList)

在 simpleperf 命令中设置实参

参数
arguList :子命令和实参的列表

受保护的方法

commandStringPreparer

protected String commandStringPreparer (String command)

参数
command String

返回
String