ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ResourceMetricUtil
public
class
ResourceMetricUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.monitoring.collector.ResourceMetricUtil
|
ฟังก์ชันยูทิลิตีสําหรับการเขียนเมตริก
สรุป
เมธอดสาธารณะ |
static
float
|
ConvertedMetricValue(String original, float conversionDivisor)
แปลงค่าเมตริกเป็นหน่วยอื่นและจัดรูปแบบค่าเอาต์พุต
|
static
|
GetCommandResponse(IDeviceManager deviceManager, String serial, String cmd, long timeoutMs)
ดำเนินการตามคําสั่ง adb และแสดงผลลัพธ์หากสําเร็จ
|
static
Timestamp
|
GetCurrentTimestamp()
รับการประทับเวลาปัจจุบันจากนาฬิกา UTC ของระบบ
|
static
float
|
RoundedMetricValue(String original)
แยกวิเคราะห์และจัดรูปแบบค่าเมตริก
|
ตัวสร้างแบบสาธารณะ
ResourceMetricUtil
public ResourceMetricUtil ()
เมธอดสาธารณะ
ConvertedMetricValue
public static float ConvertedMetricValue (String original,
float conversionDivisor)
แปลงค่าเมตริกเป็นหน่วยอื่นและจัดรูปแบบค่าเอาต์พุต
พารามิเตอร์ |
original |
String : สตริงค่าเดิม |
conversionDivisor |
float : ตัวหารสำหรับการแปลงหน่วย |
คิกรีเทิร์น |
float |
ค่าทศนิยมเอาต์พุต |
การโยน |
NumberFormatException |
หากสตริงต้นฉบับเป็น Null |
GetCommandResponse
public static GetCommandResponse (IDeviceManager deviceManager,
String serial,
String cmd,
long timeoutMs)
ดำเนินการตามคําสั่ง adb และแสดงผลลัพธ์หากสําเร็จ
พารามิเตอร์ |
deviceManager |
IDeviceManager : อินสแตนซ์ IDeviceManager สำหรับเรียกใช้คําสั่งในอุปกรณ์ที่ "พร้อมใช้งาน"
|
serial |
String : ซีเรียลของอุปกรณ์ |
cmd |
String : สตริงคําสั่ง |
timeoutMs |
long : เวลาที่รอเป็นมิลลิวินาที |
GetCurrentTimestamp
public static Timestamp GetCurrentTimestamp ()
รับการประทับเวลาปัจจุบันจากนาฬิกา UTC ของระบบ
RoundedMetricValue
public static float RoundedMetricValue (String original)
แยกวิเคราะห์และจัดรูปแบบค่าเมตริก
พารามิเตอร์ |
original |
String : สตริงค่าเดิม |
คิกรีเทิร์น |
float |
ค่าทศนิยมเอาต์พุต |
การโยน |
NumberFormatException |
หากสตริงต้นฉบับเป็น Null |
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 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. |"]]