Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ff958e1 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Enhance atest config of WmPerfTests

To support perfetto trace collection and device stabilization.

Bug: 162415863
Bug: 161782101
Bug: 161781292
Test: atest WmPerfTests
Change-Id: I48d38d33144d2deebcb152a3d527cc45b80f0dec
parent 8cb800ad
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ android_test {
        "platform-test-annotations",
    ],
    test_suites: ["device-tests"],
    data: [":perfetto_artifacts"],
    platform_apis: true,
    certificate: "platform",
}
+31 −3
Original line number Diff line number Diff line
@@ -28,14 +28,42 @@
        <option name="run-command" value="cmd package compile -m speed com.android.perftests.wm" />
    </target_preparer>

    <!-- Needed for pushing the trace config file -->
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="push-file" key="trace_config_detailed.textproto" value="/data/misc/perfetto-traces/trace_config.textproto" />
    </target_preparer>

    <!-- Needed for storing the perfetto trace files in the sdcard/test_results-->
    <option name="isolated-storage" value="false" />

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.perftests.wm" />
        <option name="hidden-api-checks" value="false"/>
        <option name="device-listeners" value="android.wm.WmPerfRunListener" />

        <!-- Listener related args for collecting the traces and waiting for the device to stabilize. -->
        <option name="device-listeners" value="android.wm.WmPerfRunListener,android.device.collectors.ProcLoadListener,android.device.collectors.PerfettoListener" />

        <!-- Guarantee that user defined RunListeners will be running before any of the default listeners defined in this runner. -->
        <option name="instrumentation-arg" key="newRunListenerMode" value="true" />

        <!-- ProcLoadListener related arguments -->
        <!-- Wait for device last minute threshold to reach 3 with 2 minute timeout before starting the test run -->
        <option name="instrumentation-arg" key="procload-collector:per_run" value="true" />
        <option name="instrumentation-arg" key="proc-loadavg-threshold" value="3" />
        <option name="instrumentation-arg" key="proc-loadavg-timeout" value="120000" />
        <option name="instrumentation-arg" key="proc-loadavg-interval" value="10000" />

        <!-- PerfettoListener related arguments -->
        <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true" />
        <option name="instrumentation-arg" key="perfetto_config_file" value="trace_config.textproto" />

        <option name="instrumentation-arg" key="newRunListenerMode" value="true" />
    </test>

    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="directory-keys" value="/data/local/WmPerfTests" />
        <option name="collect-on-run-ended-only" value="true" />
        <option name="directory-keys" value="/data/local/tmp/WmPerfTests" />
        <!-- Needed for pulling the collected trace config on to the host -->
        <option name="pull-pattern-keys" value="perfetto_file_path" />
    </metrics_collector>
</configuration>
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public class WindowManagerPerfTestBase {
     * is in /data because while enabling method profling of system server, it cannot write the
     * trace to external storage.
     */
    static final File BASE_OUT_PATH = new File("/data/local/WmPerfTests");
    static final File BASE_OUT_PATH = new File("/data/local/tmp/WmPerfTests");

    @BeforeClass
    public static void setUpOnce() {