Skip to content

Commit

Permalink
Switch from Time Profiler to CPU Profiler (#35)
Browse files Browse the repository at this point in the history
* Switch to CPU Profiler

* Update README
  • Loading branch information
hmallen99 authored Aug 29, 2024
1 parent e86c80b commit 1b89954
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ appium driver doctor uiautomator2
Run appium with the desired capabilities. the `udid` option can be omitted if using a simulator.

```
appium --relaxed-security --default-capabilities \
appium --relaxed-security --base-path=/wd/hub --default-capabilities \
"{\"appium:deviceName\": \"<Your device name here>", \
\"platformName\": \"iOS", \
\"appium:app\": \"com.rbckr.TestApp", \
Expand Down Expand Up @@ -224,3 +224,9 @@ const runBenchmarkSuite = async () => {
```

4. Follow the directions above to rebuild the app and rebundle the appium benchmark

## Profiling with Xcode Instuments

Currently, the `CPU Profiler` is being used to profile the app with Appium. This can be swapped out for other profilers by chaning out the `profileName` argument in the `startPerfRecord` command in `runBenchmarkWithProfiler`.

A custom template can be used when profiling locally. For instance, if you want to profile CPU cache misses, you could create a `CPU Counter` template in XCode instruments and specify L1 cache misses in Instruments -> File -> Recording Options. For more details, see: https://www.advancedswift.com/counters-in-instruments/.
4 changes: 2 additions & 2 deletions packages/benchmarking/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ async function runBenchmark(testId: string, driver: Browser) {
async function runBenchmarkWithProfiler(testId: string, driver: Browser) {
const perfTracePath = `${perfTraceDir}/${testId}-trace.zip`;
await driver.execute("mobile: startPerfRecord", {
profileName: "Time Profiler",
profileName: "CPU Profiler",
pid: "current",
timeout: 2000,
});

await runBenchmark(testId, driver);

const output = (await driver.execute("mobile: stopPerfRecord", {
profileName: "Time Profiler",
profileName: "CPU Profiler",
})) as string;

let buff = Buffer.from(output, "base64");
Expand Down

0 comments on commit 1b89954

Please sign in to comment.