Skip to content

Commit c88496e

Browse files
committed
wip
1 parent b2fc83f commit c88496e

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

packages/commands/test/src/PerformanceMeasurer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ export class PerformanceMeasurer {
5555
});
5656
}
5757

58-
forceStop() {
58+
async forceStop() {
59+
// Ensure polling has stopped
5960
this.polling?.stop();
61+
// Hack for ios-instruments to get the measures at the end of the test
62+
await profiler.getMeasures();
6063
}
6164

6265
async stop(duration?: number): Promise<TestCaseIterationResult> {
@@ -77,10 +80,7 @@ export class PerformanceMeasurer {
7780
await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL * 2));
7881
}
7982

80-
// Ensure polling has stopped
81-
this.polling?.stop();
82-
// Hack for ios-instruments to get the measures at the end of the test
83-
await profiler.getMeasures();
83+
await this.forceStop();
8484

8585
await this.maybeStopRecording();
8686

packages/platforms/ios-instruments/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ Requirements:
44

55
- `maestro` installed
66
- `node` installed
7+
- `idb` installed
78

89
## Steps
910

10-
- Get a running simulator id with `xcrun simctl list devices`
11-
- Create template Flashlight in Xcode Instruments (with cpu-profile and memory usage)
12-
- Add your own test in `test.yaml`
13-
- `PLATFORM=ios-instruments node packages/commands/test/dist/bin.js test --bundleId <YOUR_APP_ID> --simulatorId 9F852910-03AD-495A-8E16-7356B764284 --testCommand "maestro test test.yaml" --resultsFilePath "./result.json"`
11+
PLATFORM=ios-instruments node packages/commands/test/dist/bin.js test --bundleId <YOUR_APP_ID> --testCommand "maestro test test.yaml" --resultsFilePath "./result.json"`
1412

1513
- Check the results in the web-reporter
1614
`yarn workspace @perf-profiler/web-reporter build`

packages/platforms/ios-instruments/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const startRecord = async (
1515
): Promise<ChildProcess> => {
1616
const templateFilePath = `${__dirname}/../Flashlight.tracetemplate`;
1717
const recordingProcess = executeAsync(
18-
`xcrun xctrace record --device ${deviceUdid} --template ${templateFilePath} --attach ${appPid} --output ${traceFile}`
18+
`arch -arm64 xcrun xctrace record --device ${deviceUdid} --template ${templateFilePath} --attach ${appPid} --output ${traceFile}`
1919
);
2020
await new Promise<void>((resolve) => {
2121
recordingProcess.stdout?.on("data", (data) => {
@@ -30,7 +30,7 @@ const startRecord = async (
3030
const saveTraceFile = (traceFile: string): string => {
3131
const xmlOutputFile = getTmpFilePath("report.xml");
3232
executeCommand(
33-
`xctrace export --input ${traceFile} --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output ${xmlOutputFile}`
33+
`arch -arm64 xctrace export --input ${traceFile} --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output ${xmlOutputFile}`
3434
);
3535
return xmlOutputFile;
3636
};

0 commit comments

Comments
 (0)