Skip to content

Commit 4996384

Browse files
committed
wip
1 parent dc16eb8 commit 4996384

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
@@ -39,8 +39,11 @@ export class PerformanceMeasurer {
3939
});
4040
}
4141

42-
forceStop() {
42+
async forceStop() {
43+
// Ensure polling has stopped
4344
this.polling?.stop();
45+
// Hack for ios-instruments to get the measures at the end of the test
46+
await profiler.getMeasures();
4447
}
4548

4649
async stop(duration?: number) {
@@ -61,10 +64,7 @@ export class PerformanceMeasurer {
6164
await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL * 2));
6265
}
6366

64-
// Ensure polling has stopped
65-
this.polling?.stop();
66-
// Hack for ios-instruments to get the measures at the end of the test
67-
await profiler.getMeasures();
67+
await this.forceStop();
6868

6969
return {
7070
time: time ?? 0,

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)