A partir de 27 de março de 2025, recomendamos usar android-latest-release
em vez de aosp-main
para criar e contribuir com o AOSP. Para mais informações, consulte Mudanças no AOSP.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
ResourceMetricUtil
public class ResourceMetricUtil
extends Object
java.lang.Object |
↳ | com.android.tradefed.monitoring.collector.ResourceMetricUtil |
Funções utilitárias para composição de métricas.
Resumo
Métodos públicos |
---|
static float | ConvertedMetricValue (String original, float conversionDivisor) Converte o valor da métrica em unidades diferentes e formata o valor de saída. |
static | GetCommandResponse ( IDeviceManager deviceManager, String serial, String cmd, long timeoutMs) Executa o comando adb e retorna uma resposta se for bem-sucedido. |
static Timestamp | GetCurrentTimestamp () Obtém o carimbo de data/hora atual do relógio UTC do sistema. |
static float | RoundedMetricValue (String original) Analise e formate o valor da métrica. |
Construtores públicos
ResourceMetricUtil
public ResourceMetricUtil ()
Métodos públicos
Valor Métrico Convertido
public static float ConvertedMetricValue (String original,
float conversionDivisor)
Converte o valor da métrica em unidades diferentes e formata o valor de saída.
Parâmetros |
---|
original | String : a string do valor original. |
conversionDivisor | float : o divisor para conversão de unidades. |
Devoluções |
---|
float | O valor flutuante de saída. |
Lança |
---|
NumberFormatException | se a string original for nula. |
ObterCommandResponse
public static GetCommandResponse (IDeviceManager deviceManager,
String serial,
String cmd,
long timeoutMs)
Executa o comando adb e retorna uma resposta se for bem-sucedido.
Parâmetros |
---|
deviceManager | IDeviceManager : a instância IDeviceManager para executar comandos em dispositivos "Disponíveis". |
serial | String : o serial do dispositivo. |
cmd | String : a string do comando. |
timeoutMs | long : o tempo de espera em milissegundos. |
ObterCurrentTimestamp
public static Timestamp GetCurrentTimestamp ()
Obtém o carimbo de data/hora atual do relógio UTC do sistema.
ValorMétrico Arredondado
public static float RoundedMetricValue (String original)
Analise e formate o valor da métrica.
Parâmetros |
---|
original | String : a string do valor original. |
Devoluções |
---|
float | O valor flutuante de saída. |
Lança |
---|
NumberFormatException | se a string original for nula. |
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2023-12-01 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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. |"]]