HostStatsdMetricCollector

public class HostStatsdMetricCollector
extends BaseDeviceMetricCollector

java.lang.Object
   ↳ com.android.tradefed.device.metric.BaseDeviceMetricCollector
     ↳ com.android.tradefed.device.metric.HostStatsdMetricCollector


A IMetricCollector that collects statsd metrics from host side using statsd utility commands. It has basic push metrics and dump report functions. It can be extended by subclasses to process statsd metric report based on the needs.

Summary

Public constructors

HostStatsdMetricCollector()

Public methods

void onTestEnd(DeviceMetricData testData, currentTestCaseMetrics)

Callback when a test case is ended.

void onTestFail(DeviceMetricData testData, TestDescription test)

Callback when a test case fails.

void onTestRunEnd(DeviceMetricData runData, currentRunMetrics)

Callback when a test run is ended.

void onTestRunStart(DeviceMetricData runData)

Callback when a test run is started.

void onTestStart(DeviceMetricData testData)

Callback when a test case is started.

Protected methods

void processStatsReport(ITestDevice device, InputStreamSource dataStream, DeviceMetricData runData)

Subclasses can implement the method to process Statsd metric report if needed.

Public constructors

HostStatsdMetricCollector

public HostStatsdMetricCollector ()

Public methods

onTestEnd

public void onTestEnd (DeviceMetricData testData, 
                 currentTestCaseMetrics)

Callback when a test case is ended. This should be the time for clean up.

Parameters
testData DeviceMetricData: the DeviceMetricData holding the data for the test case. Will be the same object as during onTestStart(com.android.tradefed.device.metric.DeviceMetricData).

currentTestCaseMetrics : the current map of metrics passed to ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)).

Throws
DeviceNotAvailableException

onTestFail

public void onTestFail (DeviceMetricData testData, 
                TestDescription test)

Callback when a test case fails.

Parameters
testData DeviceMetricData: the DeviceMetricData holding the data for the test case.

test TestDescription: the TestDescription of the test case in progress.

onTestRunEnd

public void onTestRunEnd (DeviceMetricData runData, 
                 currentRunMetrics)

Callback when a test run is ended. This should be the time for clean up.

Parameters
runData DeviceMetricData: the DeviceMetricData holding the data for the run. Will be the same object as during onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData).

currentRunMetrics : the current map of metrics passed to ERROR(/#testRunEnded(long,Map)).

Throws
DeviceNotAvailableException

onTestRunStart

public void onTestRunStart (DeviceMetricData runData)

Callback when a test run is started.

Parameters
runData DeviceMetricData: the DeviceMetricData holding the data for the run.

Throws
DeviceNotAvailableException

onTestStart

public void onTestStart (DeviceMetricData testData)

Callback when a test case is started.

Parameters
testData DeviceMetricData: the DeviceMetricData holding the data for the test case.

Throws
DeviceNotAvailableException

Protected methods

processStatsReport

protected void processStatsReport (ITestDevice device, 
                InputStreamSource dataStream, 
                DeviceMetricData runData)

Subclasses can implement the method to process Statsd metric report if needed. It is called for metric report from a particular device

Parameters
device ITestDevice: Test device where the statsd report is coming from

dataStream InputStreamSource: Stats report as input stream

runData DeviceMetricData: The destination where the processed metrics will be stored