As part of a research project, I am trying perform callstack sampling using Perfetto's cpu_profiler while running the Android Compatibility Test Suite (CTS) using a Cuttlefish Virtual Device (CVD) .
My problem is that the CVD frequently disconnects, which makes the tests fail, and prevents me from collecting the callstacks I want.
I'm adding a relevant part of the CTS logs:
05-28 14:20:53 D/NativeDevice: Device 0.0.0.0:6520 state is now NOT_AVAILABLE
05-28 14:21:04 D/NativeDevice: Device 0.0.0.0:6520 state is now ONLINE
05-28 14:21:22 W/NativeDevice: There is no reboot history since 1685276476000
05-28 14:21:22 E/ModuleDefinition: Detected a soft-restart after module x86 CtsNativeNetDnsTestCases
05-28 14:21:22 E/LeakedThreadStatusChecker: We have 3 threads instead of 1. List: [Thread[Invocation-0.0.0.0:6520,5,Invocation-0.0.0.0:6520], Thread[BackgroundDeviceAction-logcat -v threadtime,uid,5,Invocation-
0.0.0.0:6520], Thread[Timer-1,5,Invocation-0.0.0.0:6520]]
05-28 14:21:22 W/ITestSuite: System status checker [com.android.tradefed.suite.checker.LeakedThreadStatusChecker] failed
05-28 14:21:22 W/DeviceSettingChecker: Setting in namespace global fails:
boot_count changes from 99 to 100
05-28 14:21:22 W/ITestSuite: System status checker [com.android.tradefed.suite.checker.DeviceSettingChecker] failed
05-28 14:21:23 W/ITestSuite: There are failed system status checkers: {com.android.tradefed.suite.checker.LeakedThreadStatusChecker=We have 3 threads instead of 1. List: [Thread[Invocation-0.0.0.0:6520,5,Invocation-0.0.0.0:6520], Thread[BackgroundDeviceAction-logcat -v threadtime,uid,5,Invocation-0.0.0.0:6520], Thread[Timer-1,5,Invocation-0.0.0.0:6520]], com.android.tradefed.suite.checker.DeviceSettingChecker=Setting in namespace global fails:
boot_count changes from 99 to 100
I know the problem comes from doing the profiling in parallel, because when I disable it, the tests run without failure and without device disconnection.
I should note that the CTS and CVD were built from the Android 13.0.0_r42 branch
I tried reducing the sampling frequency in the perfetto config file to 10 samples per second (which is very low compared to what I want), and I expected it to make the disconnecting less frequent, but this does not seem to be the case.
Is there maybe another way to achieve what I want to achieve?
Thanks in advance for any help!