החל מ-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 |
ערך המספר הממשי (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 |
ערך המספר הממשי (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. |"]]