Stay organized with collections Save and categorize content based on your preferences.

ResourceMetricUtil

public class ResourceMetricUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.monitoring.collector.ResourceMetricUtil


Utility functions for composing metrics.

Summary

Public constructors

ResourceMetricUtil()

Public methods

static float ConvertedMetricValue(String original, float conversionDivisor)

Converts the metric value to different units and formats the output value.

static GetCommandResponse(IDeviceManager deviceManager, String serial, String cmd, long timeoutMs)

Executes adb command and returns response if succeed.

static Timestamp GetCurrentTimestamp()

Gets current timestamp from system UTC clock.

static float RoundedMetricValue(String original)

Parse and format the metric value.

Public constructors

ResourceMetricUtil

public ResourceMetricUtil ()

Public methods

ConvertedMetricValue

public static float ConvertedMetricValue (String original, 
                float conversionDivisor)

Converts the metric value to different units and formats the output value.

Parameters
original String: the original value string.

conversionDivisor float: the divisor for unit conversion.

Returns
float The output float value.

Throws
NumberFormatException if the original string is null.

GetCommandResponse

public static  GetCommandResponse (IDeviceManager deviceManager, 
                String serial, 
                String cmd, 
                long timeoutMs)

Executes adb command and returns response if succeed.

Parameters
deviceManager IDeviceManager: the IDeviceManager instance for executing command on "Available" devices.

serial String: the device serial.

cmd String: the command string.

timeoutMs long: the time to wait in milliseconds.

Returns
A CommandResult instance.

GetCurrentTimestamp

public static Timestamp GetCurrentTimestamp ()

Gets current timestamp from system UTC clock.

Returns
Timestamp

RoundedMetricValue

public static float RoundedMetricValue (String original)

Parse and format the metric value.

Parameters
original String: the original value string.

Returns
float The output float value.

Throws
NumberFormatException if the original string is null.