Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
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 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. |
GetCurrentTimestamp
public static Timestamp GetCurrentTimestamp ()
Gets current timestamp from system UTC clock.
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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-07-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-07-19 UTC."],[],[]]