Skip to content

Commit 615aa21

Browse files
committed
Use system simpleperf for API level 29 and above
1 parent b948635 commit 615aa21

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/profiler.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,18 @@ class ProfilerDebugAdapter extends debugadapter.LoggingDebugSession {
150150
let target: Device = config.target;
151151

152152
try {
153-
this.consoleLog("Setup simpleperf on device");
154153
const deviceAdb = await android.getDeviceAdb(target);
155-
const simpleperfDevicePath = await android.pushSimpleperf(deviceAdb);
154+
155+
// Use system simpleperf for API level 29 and above
156+
let simpleperfDevicePath: string;
157+
const apiLevel = await deviceAdb.getApiLevel();
158+
if (apiLevel >= 29) {
159+
simpleperfDevicePath = "/system/bin/simpleperf";
160+
}
161+
else {
162+
this.consoleLog("Setup simpleperf on device");
163+
simpleperfDevicePath = await android.pushSimpleperf(deviceAdb);
164+
}
156165

157166
const simpleperfCommand = await this.getSimpleperfCommand(deviceAdb, simpleperfDevicePath);
158167

0 commit comments

Comments
 (0)