Skip to content

fix: fix fps safe zone with higher frame rates#345

Open
Almouro wants to merge 4 commits into
mainfrom
fix/fps-safe-zone
Open

fix: fix fps safe zone with higher frame rates#345
Almouro wants to merge 4 commits into
mainfrom
fix/fps-safe-zone

Conversation

@Almouro
Copy link
Copy Markdown
Contributor

@Almouro Almouro commented Jun 19, 2025

No description provided.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 19, 2025

Deploy Preview for flashlight-docs canceled.

Name Link
🔨 Latest commit 06e1be7
🔍 Latest deploy log https://app.netlify.com/projects/flashlight-docs/deploys/685411822c445300082a89ce

@Almouro Almouro force-pushed the fix/fps-safe-zone branch from 1a11c97 to 2e91890 Compare June 19, 2025 12:35
@Almouro Almouro force-pushed the fix/fps-safe-zone branch from 2e91890 to 61160dd Compare June 19, 2025 12:51
@bamlab bamlab deleted a comment from flashlight-bot Jun 19, 2025
@bamlab bamlab deleted a comment from flashlight-bot Jun 19, 2025
@bamlab bamlab deleted a comment from flashlight-bot Jun 19, 2025
@Almouro Almouro force-pushed the fix/fps-safe-zone branch from 38319d3 to 06e1be7 Compare June 19, 2025 13:32
@bamlab bamlab deleted a comment from flashlight-bot Jun 19, 2025
@flashlight-bot
Copy link
Copy Markdown
Contributor

Flashlight Automated Report 🔦

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the FPS "safe zone" band on the web report so it scales to the device's actual refresh rate (e.g., 90/120 Hz) instead of being hard-coded to 57–60. The refresh rate is now persisted on each TestCaseResult via a new specs.refreshRate field, plumbed from profiler.detectDeviceRefreshRate() at write time and consumed by FPSReport through Report.getRefreshRate(). Also corrects the Samsung A10s core-count copy from 4 to 8.

Changes:

  • Persist specs.refreshRate on test results in the test command and the iOS-instruments writer, and tighten the specs field on TestCaseResult / AveragedTestCaseResult.
  • Compute the FPS safe-zone interval dynamically from reports[0].getRefreshRate() (95% of target → target).
  • Update the CPU explanation copy and corresponding snapshots from 4 cores/400% to 8 cores/800%.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/core/types/index.ts Changes specs from optional to DeviceSpecs | undefined on result types.
packages/commands/test/src/writeReport.ts Populates specs.refreshRate via profiler.detectDeviceRefreshRate().
packages/commands/test/src/tests/writeResults.ts Mocks detectDeviceRefreshRate returning 120.
packages/commands/test/src/tests/measurePerformance.test.ts Adds detectDeviceRefreshRate mock and updated snapshot expectation.
packages/platforms/ios-instruments/src/writeReport.ts Adds specs.refreshRate using the existing FAKE_FPS constant.
packages/core/web-reporter-ui/src/sections/FPSReport.tsx Switches prop to reports and derives the safe-zone band from refresh rate.
packages/core/web-reporter-ui/ReporterView.tsx Passes selectedReports to FPSReport; adds placeholder specs: undefined.
packages/core/web-reporter-ui/src/sections/ReportSummary/Explanations.tsx Updates Samsung A10s core count from 4 to 8.
packages/core/web-reporter-ui/tests/snapshots/ReporterView.test.tsx.snap Snapshot updates for the copy change.
packages/commands/measure/src/tests/snapshots/measure.test.tsx.snap Snapshot updates for the copy change.
yarn.lock Bumps caniuse-lite and adds an empty uid line for the linked eslint plugin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

iterations: TestCaseIterationResult[];
type?: TestCaseResultType;
specs?: DeviceSpecs;
specs: DeviceSpecs | undefined;
averageHighCpuUsage: { [processName: string]: number };
type?: TestCaseResultType;
specs?: DeviceSpecs;
specs: DeviceSpecs | undefined;
Comment on lines +12 to +18
const fpsAnnotationInterval = useMemo(() => {
const targetFps = reports[0].getRefreshRate();

return [
{ y: Math.floor(0.95 * targetFps), y2: targetFps, color: "#158000", label: "Safe Zone" },
];
}, [reports]);
Comment on lines +125 to +127
specs: {
refreshRate: FAKE_FPS,
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants