27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Sunucu destekli metrik toplayıcılar
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Ana makine tarafından yönlendirilen metrik toplayıcılar, cihaz tarafında değil ana makinede çalışır. Hedefledikleri metrikleri toplamak için cihazla ana makine tarafında etkileşim kurarlar.
Metrik toplayıcı tasarımı
Tüm toplayıcıların genişlettiği temel sınıf BaseDeviceMetricCollector
'dir. Bu sınıf, aynı paylaşılan temel işlevleri sağlamaya yardımcı olur:
- Filtreleme
- Devre dışı bırakma
- Test durumları ve test çalıştırmalarının toplanması
Toplayıcılar, ana makinedeki test yürütmeyle senkronize oldukları için sonuç raporlama modelini izler. Diğer bir deyişle, testler ana makine tarafından yürütülüyorsa test bir sonraki yürütme adımına geçmeden önce toplayıcılar yürütülür.
Örneğin, toplayıcı testEnded
üzerinde çalıştırılırsa yürütme testStart
ile sonraki teste geçmeden önce toplayıcılar çalıştırılır.
Ana makine tarafından yönlendirilen bir metrik toplayıcıyı uygulama
Temel sınıf BaseDeviceMetricCollector
'ün üzerine uygulama yaparken metriklerinizi yaşam döngüsü sırasında ne zaman toplayacağınıza karar verebilirsiniz:
- Test çalışması başladığında:
onTestRunStart
- Bir test kaydı başladığında:
onTestStart
- Bir test senaryosu sona erdiğinde:
onTestEnd
- Test çalışması sona erdiğinde:
onTestRunEnd
TF, eşzamanlı yöntemlere ek olarak, düzenli olarak eşzamansız veri toplama işlemi gerçekleştiren ScheduledDeviceMetricCollector
adlı bir temel sınıf sağlar. Bu sınıf, düzenli olarak çalıştırılacak bir collect
yöntemi sağlar.
Dönem, seçeneklere göre özelleştirilebilir.
XML yapılandırması
Nesne etiketi metrics_collector
'tir. Örneğin:
<metrics_collector class="com.android.tradefed.device.metric.AtraceCollector">
<option name="categories" value="freq"/>
</metrics_collector>
Öneriler
Aynı işi tekrarlamadığınızdan emin olmak için mevcut toplayıcı listesine bakın. Maksimum yeniden kullanılabilirlik sağlamak için her toplayıcının tek bir toplama türü gerçekleştirmesi, test yürütme sırasında farklı toplayıcıların daha fazla karıştırılmasına ve eşleştirilmesine olanak tanır.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Host-driven metrics collectors run on the host and not on the device side. They\ninteract with the device from the host side to collect the metrics they are\ntargeting.\n\nMetrics collector design\n------------------------\n\nThe base class that all collectors extend is\n[`BaseDeviceMetricCollector`](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/src/com/android/tradefed/device/metric/BaseDeviceMetricCollector.java),\nwhich helps provide the same shared basic functionalities:\n\n- Filtering\n- Disabling\n- Collection on test cases versus test runs\n\nCollectors follow a [result reporter](/docs/core/tests/tradefed/architecture/result-reporter)\nmodel because they synchronize with the test execution on the host. In other\nwords, if tests are host-driven, collectors are executed before the test\nproceeds to the next execution step.\n\nFor example, if the collector executes on `testEnded`, the collectors execute\nbefore the execution proceeds to the next test with `testStart`.\n\nImplement a host-driven metrics collector\n-----------------------------------------\n\nWhen implementing on top of the base class `BaseDeviceMetricCollector` you\ncan decide when to collect your metrics during the lifecycle:\n\n- When a test run starts: `onTestRunStart`\n- When a test case starts: `onTestStart`\n- When a test case ends: `onTestEnd`\n- When a test run ends: `onTestRunEnd`\n\nPerform asynchronous collection\n-------------------------------\n\nIn addition to the synchronous methods, TF provides a base class to implement\nthat performs periodic asynchronous collection,\n[`ScheduledDeviceMetricCollector`](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/test_framework/com/android/tradefed/device/metric/ScheduledDeviceMetricCollector.java),\nwhich provides a `collect` method to be implemented that runs\nperiodically.\n\nThe period is customizable by options.\n\nXML configuration\n-----------------\n\nThe object tag is `metrics_collector`, for example: \n\n \u003cmetrics_collector class=\"com.android.tradefed.device.metric.AtraceCollector\"\u003e\n \u003coption name=\"categories\" value=\"freq\"/\u003e\n \u003c/metrics_collector\u003e\n\nRecommendations\n---------------\n\nLook at the [existing list of collectors](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/test_framework/com/android/tradefed/device/metric)\nto ensure you aren't duplicating work. We try to ensure maximum reusability, so\nhaving each collector performing a single type of collection allows more mixing\nand matching of different collectors during test execution."]]