Od 27 marca 2025 r. zalecamy używanie android-latest-release
zamiast aosp-main
do kompilowania i wspołtworzenia AOSP. Więcej informacji znajdziesz w artykule o zmianach w AOSP.
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
TraceCmdCollector
public
class
TraceCmdCollector
extends AtraceCollector
IMetricCollector
, który zbiera ślady podczas testu za pomocą polecenia trace-cmd i zapisują je w wywołaniu.
Ten zbieracz śladów umożliwia odłączenie kabla USB podczas testu (jak w przypadku testów zasilania).
Domyślne narzędzie systemu, atrace, jest używane w połączeniu z tym kolektorem do ustawiania flag sysfs dotyczących Androida.
Należy określić binarne narzędzie trace-cmd (https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git) zgodne z Androidem.
Spowoduje to przesłanie pliku trace.dat (patrz man 5 trace-cmd.dat) utworzonego przez polecenie trace-cmd.
Podsumowanie
Konstruktory publiczne
TraceCmdCollector
public TraceCmdCollector ()
Chronione metody
startTracing
protected void startTracing (ITestDevice device)
Parametry |
device |
ITestDevice |
stopTracing
protected void stopTracing (ITestDevice device)
Parametry |
device |
ITestDevice |
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# TraceCmdCollector\n=================\n\n\n`\npublic\n\n\nclass\nTraceCmdCollector\n`\n\n\n`\n\n\n`\n\n`\n\n\n`\n\n`\n\nextends `[AtraceCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/AtraceCollector.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|---|------------------------------------------------------|\n| java.lang.Object ||||\n| ↳ | [com.android.tradefed.device.metric.BaseDeviceMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/BaseDeviceMetricCollector.html) |||\n| | ↳ | [com.android.tradefed.device.metric.AtraceCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/AtraceCollector.html) ||\n| | | ↳ | com.android.tradefed.device.metric.TraceCmdCollector |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [IMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/IMetricCollector.html) that collects traces during the test using trace-cmd, and logs them to\nthe invocation.\n\nThis trace collector allows for USB disconnection during the test (as in power testing).\n\nThe system default tool, atrace, is used in tandem with this collector to set the\nandroid-specific sysfs flags.\n\nA trace-cmd (https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git) binary\ncompatible with Android must be specified.\n\nThis will upload the trace.dat format (see man 5 trace-cmd.dat) produced by trace-cmd.\n\nSummary\n-------\n\n| ### Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[TraceCmdCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/TraceCmdCollector.html#TraceCmdCollector())`() ` |\n\n| ### Protected methods ||\n|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[LogDataType](../../../../../../../reference/tradefed/com/android/tradefed/result/LogDataType.html) | ` `[getLogType](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/TraceCmdCollector.html#getLogType())`() ` |\n| ` void` | ` `[startTracing](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/TraceCmdCollector.html#startTracing(com.android.tradefed.device.ITestDevice))`(`[ITestDevice](../../../../../../../reference/tradefed/com/android/tradefed/device/ITestDevice.html)` device) ` |\n| ` void` | ` `[stopTracing](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/TraceCmdCollector.html#stopTracing(com.android.tradefed.device.ITestDevice))`(`[ITestDevice](../../../../../../../reference/tradefed/com/android/tradefed/device/ITestDevice.html)` device) ` |\n\nPublic constructors\n-------------------\n\n### TraceCmdCollector\n\n```\npublic TraceCmdCollector ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProtected methods\n-----------------\n\n### getLogType\n\n```\nprotected LogDataType getLogType ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------------------------------------------------------------------------------------------------|--------|\n| [LogDataType](../../../../../../../reference/tradefed/com/android/tradefed/result/LogDataType.html) | \u003cbr /\u003e |\n\n### startTracing\n\n```\nprotected void startTracing (ITestDevice device)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|----------------------|\n| `device` | `ITestDevice` \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------------------------------------------------------------------------|---|\n| [DeviceNotAvailableException](../../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |\n\n### stopTracing\n\n```\nprotected void stopTracing (ITestDevice device)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|----------------------|\n| `device` | `ITestDevice` \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------------------------------------------------------------------------|---|\n| [DeviceNotAvailableException](../../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |"]]