Skip to content

Commit 9379b80

Browse files
feat(PerformanceMeasurer): setup and get measures from instruments profiler
1 parent c1b2936 commit 9379b80

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/commands/test/src/PerformanceMeasurer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ export class PerformanceMeasurer {
1919
// noop by default
2020
}
2121
) {
22+
// Hack to make sure the profiler is ready to receive measures
23+
await profiler.waitUntilReady(this.bundleId);
2224
this.polling = profiler.pollPerformanceMeasures(this.bundleId, {
2325
onMeasure: (measure) => {
24-
if (this.shouldStop) {
26+
// The ios-instruments profiler yields measures at the end of the test when the polling is already stopped
27+
if (this.shouldStop && process.env.PLATFORM !== "ios-instruments") {
2528
this.polling?.stop();
2629
}
2730

@@ -60,6 +63,8 @@ export class PerformanceMeasurer {
6063

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

6469
return {
6570
time: time ?? 0,

0 commit comments

Comments
 (0)