จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมตริก
ติดตามและรายงานเมตริกต่างๆ ของรันไทม์สำหรับแอปพลิเคชัน
อัปเดตล่าสุด |
รุ่นที่เสถียร |
รุ่นที่อาจได้รับการเผยแพร่ |
รุ่นเบต้า |
รุ่นอัลฟ่า |
27 สิงหาคม 2025 |
- |
- |
1.0.0-beta03 |
- |
การประกาศทรัพยากร Dependency
หากต้องการเพิ่มทรัพยากร Dependency ใน Metrics คุณต้องเพิ่มที่เก็บ Maven ของ Google ลงในโปรเจ็กต์
อ่านข้อมูลเพิ่มเติมได้ที่ที่เก็บ Maven ของ Google
เพิ่มการอ้างอิงสำหรับอาร์ติแฟกต์ที่คุณต้องการในไฟล์ build.gradle
สำหรับแอปหรือโมดูลของคุณ
ดึงดูด
dependencies {
implementation "androidx.metrics:metrics-performance:1.0.0-beta03"
}
Kotlin
dependencies {
implementation("androidx.metrics:metrics-performance:1.0.0-beta03")
}
ดูข้อมูลเพิ่มเติมเกี่ยวกับการพึ่งพาได้ที่เพิ่มการพึ่งพาบิลด์
ความคิดเห็น
ความคิดเห็นของคุณช่วยเราปรับปรุง Jetpack ให้ดียิ่งขึ้น โปรดแจ้งให้เราทราบหากพบปัญหาใหม่หรือมี
ไอเดียในการปรับปรุงไลบรารีนี้ โปรดดูปัญหาที่มีอยู่
ในไลบรารีนี้ก่อนสร้างปัญหาใหม่ คุณสามารถโหวตปัญหาที่มีอยู่ได้โดย
คลิกปุ่มดาว
สร้างปัญหาใหม่
ดูข้อมูลเพิ่มเติมได้ในเอกสารประกอบของเครื่องมือติดตามปัญหา
เวอร์ชัน 1.0.0
เวอร์ชัน 1.0.0-beta03
27 สิงหาคม 2025
androidx.metrics:metrics-performance:1.0.0-beta03
ได้รับการเผยแพร่แล้ว เวอร์ชัน 1.0.0-beta03 มีการเปลี่ยนแปลงเหล่านี้
การแก้ไขข้อบกพร่อง
- แก้ไข
IllegalArgumentException
("พยายามนำ OnFrameMetricsAvailableListener
ที่ไม่เคยเพิ่มออก") ระบบจะไม่พยายามบันทึกเวลาเฟรมเมื่อหน้าต่างไม่ได้เร่งด้วยฮาร์ดแวร์ เนื่องจาก Window.OnFrameMetricsAvailableListener
ไม่รองรับ (I8fef2, b/436880904)
เวอร์ชัน 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 ออกจากcreateAndTrack()
เมธอด Factory สำหรับสร้างออบเจ็กต์ JankStats
ซึ่งส่งผลต่อการเรียกกลับ OnFrameListener
เนื่องจากตอนนี้ระบบจะเรียกใช้ Listener นั้นในเธรดที่ส่งข้อมูลต่อเฟรมไปยัง JankStats
(เธรดหลัก/UI ในเวอร์ชันที่ต่ำกว่า API 24 และเธรด FrameMetrics
ใน API 24 ขึ้นไป) นอกจากนี้ ตอนนี้ระบบจะนำออบเจ็กต์ FrameData
ที่ส่งไปยัง Listener กลับมาใช้ใหม่ทุกเฟรม ดังนั้นจึงต้องคัดลอกและแคชข้อมูลจากออบเจ็กต์นั้นไว้ที่อื่นในระหว่างการเรียกกลับ เนื่องจากควรถือว่าออบเจ็กต์นั้นล้าสมัยทันทีที่ Listener กลับมา
นอกจากนี้ยังมีการแก้ไขข้อบกพร่องต่างๆ รวมถึงปัญหาการทำงานพร้อมกันด้วย
สุดท้ายนี้ การแก้ไขเพื่อนำ FrameData
มาใช้ซ้ำ (ที่กล่าวถึงข้างต้น) หมายความว่าตอนนี้จะไม่มีการจัดสรรต่อเฟรมเนื่องจากการนำส่งเมตริกเฟรม ก่อนหน้านี้มีการจัดสรรไม่มากนัก แต่แนวทางใหม่นี้หมายความว่าคุณสามารถใช้ JankStats
โดยไม่ต้องเสียค่าใช้จ่าย GC ต่อเฟรมในแอป
การเปลี่ยนแปลง API
- อัปเดตชื่อเมธอดและพารามิเตอร์ใน
PerformanceMetricsState
เพื่อให้ผลลัพธ์ของการเรียกเหล่านั้นชัดเจนยิ่งขึ้น (I56da5, b/233421985)
- เพิ่มการทดสอบเปรียบเทียบเพื่อติดตามการจัดสรร นำการจัดสรรภายในบางอย่างที่เกี่ยวข้องกับการจัดการสถานะและการรายงานออก โปรดทราบว่าตอนนี้
FrameData
ที่ส่งไปยัง Listener ถือว่าไม่เสถียร ระบบจะนำโครงสร้างนั้นกลับมาใช้ซ้ำสำหรับเฟรมถัดไป และข้อมูลจะเชื่อถือได้จนกว่า Listener จะส่งคืน
- นำ Executor ออกจากตัวสร้างสำหรับ
JankStats
ตอนนี้ระบบจะเรียกใช้ Listener ในเธรดใดก็ตามที่ได้รับข้อมูลภายใน (I12743)
การแก้ไขข้อบกพร่อง
- แก้ไขข้อขัดข้องเนื่องจากการนำ
OnFrameMetricsAvailableListener
ออก 2 ครั้ง (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
ไลบรารีมีฟังก์ชันการทำงานในการวัดและรับการเรียกกลับในแอปพลิเคชันของคุณขณะรันไทม์ ซึ่งจะช่วยค้นหาปัญหาด้านประสิทธิภาพในโลกแห่งความเป็นจริงได้
JankStats
ผสานรวม API ที่ช่วยให้แทรกข้อมูลเกี่ยวกับสถานะ UI ได้ง่ายด้วยความสามารถในการติดตามและรายงานประสิทธิภาพต่อเฟรม เพื่อให้นักพัฒนาแอปเข้าใจได้ว่าแอปพลิเคชันมีปัญหาด้านประสิทธิภาพหรือไม่ รวมถึงเวลาและสาเหตุที่เกิดปัญหา
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-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-08-27 UTC"],[],[],null,["Metrics \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| August 27, 2025 | - | - | [1.0.0-beta03](/jetpack/androidx/releases/metrics#1.0.0-beta03) | - |\n\nDeclaring dependencies\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\nGroovy \n\n```groovy\ndependencies {\n implementation \"androidx.metrics:metrics-performance:1.0.0-beta03\"\n}\n```\n\nKotlin \n\n```kotlin\ndependencies {\n implementation(\"androidx.metrics:metrics-performance:1.0.0-beta03\")\n}\n```\n\nFor more information about dependencies, see [Add build dependencies](/studio/build/dependencies).\n\nFeedback\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\nVersion 1.0.0-beta03\n\nAugust 27, 2025\n\n`androidx.metrics:metrics-performance:1.0.0-beta03` is released. Version 1.0.0-beta03 contains [these commits](https://android.googlesource.com/platform/frameworks/support/+log/7a145e052ae61e272e91ffe285e9451b8ab71870..cd8ce2bdb21194a81a76325a8e65dad5d7e28681/metrics/metrics-performance).\n\n**Bug Fixes**\n\n- Fix `IllegalArgumentException`(\"attempt to remove `OnFrameMetricsAvailableListener` that was never added\"). No attempt is made to record frame timing when a window isn't hardware accelerated, as this isn't supported by `Window.OnFrameMetricsAvailableListener`. ([I8fef2](https://android-review.googlesource.com/#/q/I8fef2d16449a9a50a2092200d28e45baae537e22), [b/436880904](https://issuetracker.google.com/issues/436880904))\n\nVersion 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\nVersion 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\nVersion 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\nVersion 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\nVersion 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\nVersion 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."]]