AggregatingProfiler

public class AggregatingProfiler
extends Object implements IAggregatingTestProfiler

java.lang.Object
   ↳ com.android.tradefed.profiler.AggregatingProfiler
Known Direct Subclasses
StubTestProfiler A stubbed ITestProfiler which does nothing. 


An ITestProfiler which handles aggregating metrics across multiple devices and test runs. This class should be used as a base class for any profiler which sends different metrics for getAggregateMetrics().

Summary

Public constructors

AggregatingProfiler()

Public methods

Map<String, Double> getAggregateMetrics()

Return metrics that have been aggregated over all tests and devices.

String getDescription()

Return a description of this test profiler.

MetricOutputData getMetricOutputUtil()

Return the MetricOutputData object used to hold formatted metrics.

List<IMetricsRecorder> getRecorders()

Return a List of all IMetricsRecorders used by this profiler.

void reportAllMetrics(ITestInvocationListener listener)

Send all of the metrics recorded by this profiler to an ITestInvocationListener.

void setUp(IInvocationContext context)

Set up the test profiler.

void startRecordingMetrics()

Begins recording metrics for a single test on all devices.

Map<String, Double> stopRecordingMetrics(TestIdentifier test)

Stops recording metrics for a single test on all devices and returns an aggregated version of the metrics.

Protected methods

Collection<ITestDevice> getDevices()

Get all ITestDevices being profiled.

void setAggregateMetrics(Map<String, Double> metrics)

Set the aggregate metrics map.

void setMetricOutputUtil(MetricOutputData mod)

Set the aggregate metrics map.

Public constructors

AggregatingProfiler

AggregatingProfiler ()

Public methods

getAggregateMetrics

Map<String, Double> getAggregateMetrics ()

Return metrics that have been aggregated over all tests and devices.

Returns
Map<String, Double> the metrics

getDescription

String getDescription ()

Return a description of this test profiler.

Returns
String the description

getMetricOutputUtil

MetricOutputData getMetricOutputUtil ()

Return the MetricOutputData object used to hold formatted metrics.

Returns
MetricOutputData the current MetricOutputData

getRecorders

List<IMetricsRecorder> getRecorders ()

Return a List of all IMetricsRecorders used by this profiler.

Returns
List<IMetricsRecorder> the recorders

reportAllMetrics

void reportAllMetrics (ITestInvocationListener listener)

Send all of the metrics recorded by this profiler to an ITestInvocationListener.

Parameters
listener ITestInvocationListener: the listener to send metrics to.

setUp

void setUp (IInvocationContext context)

Set up the test profiler.

Parameters
context IInvocationContext: the IInvocationContext of the test invocation.

Throws
DeviceNotAvailableException

startRecordingMetrics

void startRecordingMetrics ()

Begins recording metrics for a single test on all devices. This method is called on each call to testStarted(TestIdentifier).

Throws
DeviceNotAvailableException

stopRecordingMetrics

Map<String, Double> stopRecordingMetrics (TestIdentifier test)

Stops recording metrics for a single test on all devices and returns an aggregated version of the metrics. The metrics are aggregated with getMergeFunction(String). This method is called on each call to testEnded(TestIdentifier, Map).

Parameters
test TestIdentifier: the test to stop recording on

Returns
Map<String, Double> a Map containing the metrics.

Throws
DeviceNotAvailableException

Protected methods

getDevices

Collection<ITestDevice> getDevices ()

Get all ITestDevices being profiled. Exposed for testing.

Returns
Collection<ITestDevice> the ITestDevices

setAggregateMetrics

void setAggregateMetrics (Map<String, Double> metrics)

Set the aggregate metrics map. Exposed for testing.

Parameters
metrics Map

setMetricOutputUtil

void setMetricOutputUtil (MetricOutputData mod)

Set the aggregate metrics map. Exposed for testing.

Parameters
mod MetricOutputData