קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מדדים
מעקב אחרי מדדי זמן ריצה שונים של האפליקציה ודיווח עליהם
העדכון האחרון |
גרסה יציבה |
גרסה מועמדת להפצה |
גרסת בטא |
גרסת אלפא |
12 במרץ 2025 |
- |
- |
1.0.0-beta02 |
- |
הצהרת יחסי תלות
כדי להוסיף תלות ב-Metrics, צריך להוסיף את מאגר Google Maven לפרויקט. מידע נוסף זמין במאגר Maven של Google.
מוסיפים את יחסי התלות של הארטיפקטים הנדרשים בקובץ build.gradle
של האפליקציה או המודול:
מגניב
dependencies {
implementation "androidx.metrics:metrics-performance:1.0.0-beta02"
}
Kotlin
dependencies {
implementation("androidx.metrics:metrics-performance:1.0.0-beta02")
}
מידע נוסף על יחסי תלות זמין במאמר הוספת יחסי תלות ל-build.
משוב
המשוב שלכם עוזר לנו לשפר את Jetpack. אם נתקלתם בבעיות חדשות או שיש לכם רעיונות לשיפור הספרייה הזו, נשמח לשמוע מכם. לפני שיוצרים בעיה חדשה, כדאי לעיין בבעיות הקיימות בספרייה הזו. כדי להצביע על בעיה קיימת, לוחצים על לחצן הכוכב.
דיווח על בעיה חדשה
מידע נוסף זמין במסמכי התיעוד של Issue Tracker.
גרסה 1.0.0
גרסה 1.0.0-beta02
12 במרץ 2025
androidx.metrics:metrics-performance:1.0.0-beta02
משוחרר. גרסה 1.0.0-beta02 כוללת את ההוספות האלה.
תיקוני באגים
- תיקון קריסות
DelegatingFrameMetricsListener cannot be cast...
(Id891c, b/311218678).
גרסה 1.0.0-beta01
10 בינואר 2024
ה-API והפונקציונליות של הספרייה הזו יציבים כבר זמן מה. הגרסה הזו פשוט מעבירה את הספרייה לגרסת בטא.
androidx.metrics:metrics-performance:1.0.0-beta01
משוחרר. גרסה 1.0.0-beta01 כוללת את ההצהרות האלה.
גרסה 1.0.0-alpha04
5 באפריל 2023
הגרסה הזו מעדכנת את JankStats לתיקונים האחרונים, שכוללים מידע מדויק ומקיף יותר על תזמון.
androidx.metrics:metrics-performance:1.0.0-alpha04
משוחרר. גרסה 1.0.0-alpha04 מכילה את ההצהרות האלה.
שינויים ב-API
גרסה 1.0.0-alpha03
27 ביולי 2022
androidx.metrics:metrics-performance:1.0.0-alpha03
משוחרר. גרסה 1.0.0-alpha03 כוללת את ההצהרות האלה.
הגרסה הזו כוללת שיפורים קלים בממשק ה-API, ככל שהספרייה מתקרבת לגרסת בטא. אחד מהשינויים ב-API מסיר את ה-Executor מ-method המפעל createAndTrack()
ליצירת אובייקט JankStats
. לכך יש השלכות על קריאת החזרה (callback) של OnFrameListener
, כי מעכשיו הקריאה למאזין מתבצעת בשרשור שמעביר את הנתונים לכל פריים אל JankStats
(השרשור Main/UI בגרסאות ישנות יותר מ-API 24, והשרשור FrameMetrics
בגרסאות API 24 ואילך). בנוסף, אובייקט FrameData
שמוענק למאזין משמש עכשיו שוב בכל פריים, כך שצריך להעתיק את הנתונים מהאובייקט הזה ולשמור אותם במטמון במקום אחר במהלך קריאת החזרה, כי צריך להתייחס לאובייקט הזה כאל לא רלוונטי ברגע שהמאזין חוזר.
תיקנו גם כמה באגים, כולל כמה בעיות של בו-זמניות.
לבסוף, התיקון לשימוש חוזר ב-FrameData
(שצוין למעלה) מאפשר עכשיו אפס הקצאות לכל פריים בגלל העברת מדדי פריים. בעבר לא היו הרבה הקצאות, אבל הגישה החדשה מאפשרת להשתמש ב-JankStats
בלי להגדיל את זמן האחזור של GC בכל פריים באפליקציה.
שינויים ב-API
- עדכנו את השמות של השיטות והפרמטרים ב-
PerformanceMetricsState
כדי שהתוצאות של הקריאות האלה יהיו ברורות יותר. (I56da5, b/233421985)
- הוספנו בדיקות למדדי השוואה כדי לעקוב אחרי ההקצאות, והסרנו הקצאות פנימיות מסוימות שקשורות לניהול המצב ולדיווח. שימו לב ש-
FrameData
שמועברים למאזינים נחשבים עכשיו לתנודתיים. המבנה הזה ישמש שוב לפריים הבא, והנתונים מהימנים רק עד שהמאזין חוזר.
- הוסרה פונקציית ה-Executor מה-constructor של
JankStats
. מעכשיו, קוראים למאזינים בכל שרשרת שבה התקבלו הנתונים הפנימיים. (I12743)
תיקוני באגים
- תוקנה קריסה שנגרמה כתוצאה מהסרה כפולה של
OnFrameMetricsAvailableListener
(I44094, b/239457413)
- המערכת חוזרת ללוגיקת הפרסום המקורית של הודעות
OnPreDrawListener
בראש התור, כדי לאפשר תזמון עקבי וצפוי יותר של הפריימים. (I05a43, b/233358407)
- תוקן באג ב-
ConcurrentModificationException
שבו רשימת הנציגים של המאזינים השתנתה בזמן שהיא עברה חזרה ושוב כדי לשלוח נתונים לפי פריים. (Ib7693, b/236612357)
גרסה 1.0.0-alpha02
29 ביוני 2022
androidx.metrics:metrics-performance:1.0.0-alpha02
משוחרר. גרסה 1.0.0-alpha02 מכילה את ההצהרות האלה.
שינויים ב-API
תיקוני באגים
גרסה 1.0.0-alpha01
9 בפברואר 2022
androidx.metrics:metrics-performance:1.0.0-alpha01
משוחרר. גרסה 1.0.0-alpha01 מכילה את ההוספות האלה.
תכונות חדשות
- הספרייה
JankStats
מספקת פונקציונליות לכלי למדידת ביצועים ולקבלת קריאות חזרה (callbacks) באפליקציה בזמן הריצה, שיכולות לעזור לכם למצוא בעיות בביצועים בעולם האמיתי.
JankStats
משלבת ממשק API שמאפשר להחדיר בקלות מידע על מצב ממשק המשתמש, עם יכולות למעקב ולדיווח על ביצועים בכל פריים. כך המפתחים יכולים להבין לא רק אם יש לאפליקציה בעיות בביצועים, אלא גם מתי ולמה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Metrics\n=======\n\nAPI Reference \n[androidx.metrics.performance](/reference/kotlin/androidx/metrics/performance/package-summary) \nTrack and report various runtime metrics for your application \n\n| Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |\n|----------------|----------------|-------------------|-----------------------------------------------------------------|---------------|\n| March 12, 2025 | - | - | [1.0.0-beta02](/jetpack/androidx/releases/metrics#1.0.0-beta02) | - |\n\nDeclaring dependencies\n----------------------\n\nTo add a dependency on Metrics, you must add the Google Maven repository to your\nproject. Read [Google's Maven repository](/studio/build/dependencies#google-maven)\nfor more information.\n\nAdd the dependencies for the artifacts you need in the `build.gradle` file for\nyour app or module: \n\n### Groovy\n\n```groovy\ndependencies {\n implementation \"androidx.metrics:metrics-performance:1.0.0-beta02\"\n}\n```\n\n### Kotlin\n\n```kotlin\ndependencies {\n implementation(\"androidx.metrics:metrics-performance:1.0.0-beta02\")\n}\n```\n\nFor more information about dependencies, see [Add build dependencies](/studio/build/dependencies).\n\nFeedback\n--------\n\nYour feedback helps make Jetpack better. Let us know if you discover new issues or have\nideas for improving this library. Please take a look at the\n[existing issues](https://issuetracker.google.com/issues?q=componentid:1109743%20status:open)\nin this library before you create a new one. You can add your vote to an existing issue by\nclicking the star button.\n\n[Create a new issue](https://issuetracker.google.com/issues/new?component=1109743&template=1621342)\n\nSee the [Issue Tracker documentation](https://developers.google.com/issue-tracker)\nfor more information.\n\nVersion 1.0.0\n-------------\n\n### Version 1.0.0-beta02\n\nMarch 12, 2025\n\n`androidx.metrics:metrics-performance:1.0.0-beta02` is released. Version 1.0.0-beta02 contains [these commits](https://android.googlesource.com/platform/frameworks/support/+log/7a45f0bc9e0a73744b3780a6f92e1b570de58bba..7a145e052ae61e272e91ffe285e9451b8ab71870/metrics/metrics-performance).\n\n**Bug Fixes**\n\n- Fix crashes `DelegatingFrameMetricsListener cannot be cast...` ([Id891c](https://android-review.googlesource.com/#/q/Id891c0cfdd7f45ef9e3b068644a113f39c8fc383), [b/311218678](https://issuetracker.google.com/issues/311218678)).\n\n### Version 1.0.0-beta01\n\nJanuary 10, 2024\n\nThe API and functionality of this library has been stable for some time. This release simply pushes the library to beta.\n\n`androidx.metrics:metrics-performance:1.0.0-beta01` is released. [Version 1.0.0-beta01 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/a200cb82769634cecdb118ec4f0bfdf0b086e597..7a45f0bc9e0a73744b3780a6f92e1b570de58bba/metrics/metrics-performance)\n\n### Version 1.0.0-alpha04\n\nApril 5, 2023\n\nThis release updates JankStats to the latest fixes, which include more accurate and comprehensive timing information.\n\n`androidx.metrics:metrics-performance:1.0.0-alpha04` is released. [Version 1.0.0-alpha04 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/a7f0710ad21f556f0dde9bf7bdab6d2135170fd4..a200cb82769634cecdb118ec4f0bfdf0b086e597/metrics/metrics-performance)\n\n**API Changes**\n\n- `cpuDuration` now more accurate, also new `totalDuration` on API31 ([I59ce8](https://android-review.googlesource.com/#/q/I59ce8c67f06a168f96893375c8aeca5516a55d81), [b/243694893](https://issuetracker.google.com/issues/243694893))\n\n### Version 1.0.0-alpha03\n\nJuly 27, 2022\n\n`androidx.metrics:metrics-performance:1.0.0-alpha03` is released. [Version 1.0.0-alpha03 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/8094b683499b4098092c01028b55a38b49e357f2..a7f0710ad21f556f0dde9bf7bdab6d2135170fd4/metrics/metrics-performance)\n\n- This release contains minor API refinements as the library gets closer to beta. One of the API changes removes the Executor from the `createAndTrack()` factory method for creating a `JankStats` object. This has implications for the `OnFrameListener` callback, as that listener is now called on the thread which delivers the per-frame data to `JankStats` (the Main/UI thread on versions earlier than API 24, and the `FrameMetrics` thread on API 24+). Moreover, the `FrameData` object passed to the listener is now reused every frame, so data from that object must be copied and cached elsewhere during the callback, as that object should be considered obsolete as soon as the listener returns.\n\n- There were also various bug fixes, including some concurrency issues.\n\n- Finally, the fix to reuse `FrameData` (mentioned above) means that there are now zero allocations per frame due to frame metrics delivery. There weren't many allocations before, but the new approach means that you can use `JankStats` without incurring any per-frame GC overhead in your app.\n\n**API Changes**\n\n- Updated method and parameter names in `PerformanceMetricsState` to make the results of those calls clearer. ([I56da5](https://android-review.googlesource.com/#/q/I56da57b13818bf4077a64ab144222ce255f4539a), [b/233421985](https://issuetracker.google.com/issues/233421985))\n- Added benchmark tests to track allocations, eliminated some internal allocations related to state management and reporting. Note that `FrameData` passed to listeners is now considered volatile; that structure will be reused for the next frame and the data is only reliable until the listener returns.\n- Removed Executor from constructor for `JankStats`; listeners are now called on whatever thread the internal data was received upon. ([I12743](https://android-review.googlesource.com/#/q/I1274320bf29c171b82578868e657a3b01f7805c7))\n\n**Bug Fixes**\n\n- Fixed crash due to double-removal of `OnFrameMetricsAvailableListener` ([I44094](https://android-review.googlesource.com/#/q/I4409483d6e2f7287a0a93f521f68a4be9e22d969), [b/239457413](https://issuetracker.google.com/issues/239457413))\n- Return to original logic of posting `OnPreDrawListener` messages at front of queue, for more consistent and predictable frame timing. ([I05a43](https://android-review.googlesource.com/#/q/I05a434fe9453ea1be28d398e3eb284dd9b0cb64a), [b/233358407](https://issuetracker.google.com/issues/233358407))\n- Fixed `ConcurrentModificationException` bug where the list of listener delegates was being modified while it was also being iterated through to send per-frame data. ([Ib7693](https://android-review.googlesource.com/#/q/Ib769386f18e51dc6b58c935b42c5b8566c644abc), [b/236612357](https://issuetracker.google.com/issues/236612357))\n\n### Version 1.0.0-alpha02\n\nJune 29, 2022\n\n`androidx.metrics:metrics-performance:1.0.0-alpha02` is released. [Version 1.0.0-alpha02 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/db2ecbef194afcddfaede22e1d884a8959a9277c..8094b683499b4098092c01028b55a38b49e357f2/metrics/metrics-performance)\n\n**API Changes**\n\n- Renamed `MetricsStateHolder` to just Holder (within `PerformanceMetricsState`): ([I5a4d9](https://android-review.googlesource.com/#/q/I5a4d9095520399a146e6fd78eb50c86a7051738b), [b/226565716](https://issuetracker.google.com/issues/226565716), [b/213499234](https://issuetracker.google.com/issues/213499234))\n\n**Bug Fixes**\n\n- Fixed timing issue where states could be replaced with new values before the frames had been processed where the old state would have been correct ([aosp/2061892](https://android-review.googlesource.com/c/platform/frameworks/support/+/2061892/), [b/213499234](https://issuetracker.google.com/issues/213499234))\n- Fixed concurrent modification exception in adding/removing listeners ([aosp/2092714](https://android-review.googlesource.com/c/platform/frameworks/support/+/2092714/), [b/213499234](https://issuetracker.google.com/issues/230388846))\n- Made startTime calculations more accurate ([aosp/2027704](https://android-review.googlesource.com/c/platform/frameworks/support/+/2027704/), [b/213245198](https://issuetracker.google.com/issues/213245198))\n- Fixed bug in `FrameData.equals()` implementation ([aosp/2025866](https://android-review.googlesource.com/c/platform/frameworks/support/+/2025866/), [b/218296544](https://issuetracker.google.com/issues/218296544))\n\n### Version 1.0.0-alpha01\n\nFebruary 9, 2022\n\n`androidx.metrics:metrics-performance:1.0.0-alpha01` is released. [Version 1.0.0-alpha01 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/db2ecbef194afcddfaede22e1d884a8959a9277c/metrics/metrics-performance)\n\n**New Features**\n\n- The `JankStats` library provides functionality to instrument and receive callbacks in your application at runtime which can help find real world performance problems.\n- `JankStats` combines an API that makes it easy to inject information about UI state with capabilities for tracking and reporting per-frame performance to allow developers to understand not whether an application has performance issues, but when and why."]]