A partir del 27 de marzo de 2025, te recomendamos que uses android-latest-release
en lugar de aosp-main
para compilar y contribuir a AOSP. Para obtener más información, consulta Cambios en AOSP.
Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
ResourceMetricUtil
public class ResourceMetricUtil
extends Object
java.lang.Objeto |
↳ | com.android.tradefed.monitoring.collector.ResourceMetricUtil |
Funciones de utilidad para componer métricas.
Resumen
Métodos públicos |
---|
static float | ConvertedMetricValue (String original, float conversionDivisor) Convierte el valor métrico a diferentes unidades y formatea el valor de salida. |
static | GetCommandResponse ( IDeviceManager deviceManager, String serial, String cmd, long timeoutMs) Ejecuta el comando adb y devuelve una respuesta si tiene éxito. |
static Timestamp | GetCurrentTimestamp () Obtiene la marca de tiempo actual del reloj UTC del sistema. |
static float | RoundedMetricValue (String original) Analiza y formatea el valor de la métrica. |
Constructores públicos
ResourceMetricUtil
public ResourceMetricUtil ()
Métodos públicos
Valormétricoconvertido
public static float ConvertedMetricValue (String original,
float conversionDivisor)
Convierte el valor métrico a diferentes unidades y formatea el valor de salida.
Parámetros |
---|
original | String : la cadena de valor original. |
conversionDivisor | float : el divisor para la conversión de unidades. |
Devoluciones |
---|
float | El valor flotante de salida. |
Lanza |
---|
NumberFormatException | si la cadena original es nula. |
Obtener respuesta de comando
public static GetCommandResponse (IDeviceManager deviceManager,
String serial,
String cmd,
long timeoutMs)
Ejecuta el comando adb y devuelve una respuesta si tiene éxito.
Parámetros |
---|
deviceManager | IDeviceManager : la instancia de IDeviceManager para ejecutar comandos en dispositivos "disponibles". |
serial | String : el número de serie del dispositivo. |
cmd | String : la cadena de comando. |
timeoutMs | long : el tiempo de espera en milisegundos. |
Obtener marca de tiempo actual
public static Timestamp GetCurrentTimestamp ()
Obtiene la marca de tiempo actual del reloj UTC del sistema.
ValorMétricoRedondeado
public static float RoundedMetricValue (String original)
Analiza y formatea el valor de la métrica.
Parámetros |
---|
original | String : la cadena de valor original. |
Devoluciones |
---|
float | El valor flotante de salida. |
Lanza |
---|
NumberFormatException | si la cadena original es nula. |
El contenido y el código de ejemplo de esta página están sujetos a las licencias que se describen en la licencia de contenido. Java y OpenJDK son marcas registradas de Oracle o sus entidades asociadas.
Última actualización: 2023-12-01 (UTC).
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Me falta la información que necesito","missingTheInformationINeed","thumb-down"],["Es demasiado complicado o hay demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Está obsoleto","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema de muestras o código","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2023-12-01 (UTC)."],[],[],null,["# ResourceMetricUtil\n==================\n\n\n`\npublic\n\n\nclass\nResourceMetricUtil\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.monitoring.collector.ResourceMetricUtil |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nUtility functions for composing metrics.\n\nSummary\n-------\n\n| ### Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[ResourceMetricUtil](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/ResourceMetricUtil.html#ResourceMetricUtil())`() ` |\n\n| ### Public methods ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static float` | ` `[ConvertedMetricValue](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/ResourceMetricUtil.html#ConvertedMetricValue(java.lang.String,%20float))`(String original, float conversionDivisor) ` Converts the metric value to different units and formats the output value. |\n| ` static ` | ` `[GetCommandResponse](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/ResourceMetricUtil.html#GetCommandResponse(com.android.tradefed.device.IDeviceManager,%20java.lang.String,%20java.lang.String,%20long))`(`[IDeviceManager](../../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceManager.html)` deviceManager, String serial, String cmd, long timeoutMs) ` Executes adb command and returns response if succeed. |\n| ` static Timestamp` | ` `[GetCurrentTimestamp](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/ResourceMetricUtil.html#GetCurrentTimestamp())`() ` Gets current timestamp from system UTC clock. |\n| ` static float` | ` `[RoundedMetricValue](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/ResourceMetricUtil.html#RoundedMetricValue(java.lang.String))`(String original) ` Parse and format the metric value. |\n\nPublic constructors\n-------------------\n\n### ResourceMetricUtil\n\n```\npublic ResourceMetricUtil ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### ConvertedMetricValue\n\n```\npublic static float ConvertedMetricValue (String original, \n float conversionDivisor)\n```\n\nConverts the metric value to different units and formats the output value.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------------|--------------------------------------------------|\n| `original` | `String`: the original value string. \u003cbr /\u003e |\n| `conversionDivisor` | `float`: the divisor for unit conversion. \u003cbr /\u003e |\n\n| Returns ||\n|---------|--------------------------------|\n| `float` | The output float value. \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------|---------------------------------|\n| `NumberFormatException` | if the original string is null. |\n\n### GetCommandResponse\n\n```\npublic static GetCommandResponse (../../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceManager.html deviceManager, \n String serial, \n String cmd, \n long timeoutMs)\n```\n\nExecutes adb command and returns response if succeed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|----------------------------------------------------------------------------------------------------|\n| `deviceManager` | `IDeviceManager`: the IDeviceManager instance for executing command on \"Available\" devices. \u003cbr /\u003e |\n| `serial` | `String`: the device serial. \u003cbr /\u003e |\n| `cmd` | `String`: the command string. \u003cbr /\u003e |\n| `timeoutMs` | `long`: the time to wait in milliseconds. \u003cbr /\u003e |\n\n| Returns ||\n|---|--------------------------------------------------------------------------------------------------------------------------|\n| | A [CommandResult](../../../../../../../reference/tradefed/com/android/tradefed/util/CommandResult.html) instance. \u003cbr /\u003e |\n\n### GetCurrentTimestamp\n\n```\npublic static Timestamp GetCurrentTimestamp ()\n```\n\nGets current timestamp from system UTC clock.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------------|--------|\n| `Timestamp` | \u003cbr /\u003e |\n\n### RoundedMetricValue\n\n```\npublic static float RoundedMetricValue (String original)\n```\n\nParse and format the metric value.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------------------------------------|\n| `original` | `String`: the original value string. \u003cbr /\u003e |\n\n| Returns ||\n|---------|--------------------------------|\n| `float` | The output float value. \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------|---------------------------------|\n| `NumberFormatException` | if the original string is null. |"]]