Calculation of FPS is not accurate
See original GitHub issueDescription:
After running this package with a release version of an app, I noticed that the FPS was always at 60. I downloaded the CSV from the generated web report and results in that CSV were also showing 60 FPS. So I debugged the calculation of FPS and I saw a comment:
But in my test cases automation is done to scroll the FlashList which means the list won’t be idle and the FPS generation in such case seems faulty. I also tried to log the frameTimes and it had 2 items only once. In every consequent calculations this frameTimes array is empty. Which makes the frameCount = 0 and we go to the assumption of FPS being 60, which is not precise.
Test case:
import { AppiumDriver } from "@bam.tech/appium-helper";
import { TestCase, measurePerformance } from "@perf-profiler/e2e";
const bundleId = "com.some.id";
const getTestCases = async () => {
const driver = await AppiumDriver.create({
appPackage: bundleId,
appActivity: `${bundleId}.MainActivity`,
});
const scrollTestCase: TestCase = {
beforeTest: async () => {
driver.stopApp();
driver.startApp();
await driver.clickElementByText("someButton1");
await driver.clickElementByText("someButton2");
},
run: async () => {
await driver.wait(2000)
for (let index = 0; index < 5; index++) {
await driver.scrollDown(2);
}
await driver.clickElementById("someButton3");
},
};
return {
SCROLL: scrollTestCase,
};
};
test("e2e", async () => {
const testCases = await getTestCases();
const { writeResults } = await measurePerformance(
bundleId,
testCases.SCROLL,
1
);
writeResults();
});
Logs Output:
console.log frameTimes [ 50, 32.29 ]
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 2
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 54.12520000000001
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log frameTimes []
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:45:11)
at Array.forEach (<anonymous>)
console.log frameCount 0
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:46:11)
at Array.forEach (<anonymous>)
console.log final FPS: 60
at processOutput (../android-performance-profiler/src/commands/gfxInfo/pollFpsUsage.ts:63:11)
at Array.forEach (<anonymous>)
console.log [19:13:46] ✅ Finished iteration 1/1 in 10028.164417028427ms
at log (../logger/index.ts:25:11)
Now this 2 items concluding to 54 FPS is not present in the CSV and also not reflected on the web page report.
CSV:
Report:
Let me know if I can help with anything else in explaining 🙂
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (6 by maintainers)

Top Related StackOverflow Question
Thanks for all the details @hurali97 !
Right, I see what the issue is, the frame times are on your 3rd window in the list, which is the one seemingly active, but the script takes the first one by default. Should be able to fix that soon!
Hi @hurali97, sorry that it took so long~ 🙏
But the last version should drastically improve accuracy of measures! 🥳 The FPS measuring was completely overhauled and are retrieved via
atracenow instead ofgfxinfoLet me know if that works for you!