From c6d4ded6cfcbbe34081b1efcc002f8d07dfb8831 Mon Sep 17 00:00:00 2001 From: Tomi Alu Date: Sun, 15 Sep 2024 18:13:57 +0100 Subject: [PATCH] refactor(results): Add refresh rate to results model For consistency, refresh rate is added to the DeviceSpecs property of the TestCaseResult and AveragedTestCaseResult chore(test): update snapshots refactor: remove unneeded changes refactor: use logger for error --- .../__snapshots__/measure.test.tsx.snap | 22 +++---- .../measure/src/server/socket/socketState.ts | 3 + .../measure/src/webapp/MeasureWebApp.tsx | 15 +---- packages/commands/report/src/App.tsx | 8 +-- .../test/src/SingleIterationTester.ts | 2 +- packages/commands/test/src/writeReport.ts | 4 +- .../core/reporter/src/reporting/Report.ts | 23 ++++--- .../core/reporter/src/reporting/getScore.ts | 4 +- packages/core/types/index.ts | 2 + .../core/web-reporter-ui/ReporterView.tsx | 28 ++------ .../__tests__/ReporterView.test.tsx | 10 +-- .../__snapshots__/ReporterView.test.tsx.snap | 66 +++++++------------ .../sections/ReportSummary/Explanations.tsx | 20 +++--- .../ReportSummary/ReportSummary.component.tsx | 10 +-- .../ReportSummary/ReportSummaryCard.tsx | 17 +++-- .../detectCurrentDeviceRefreshRate.ts | 2 +- packages/plugins/appium-test-cases/index.ts | 4 +- 17 files changed, 89 insertions(+), 151 deletions(-) diff --git a/packages/commands/measure/src/__tests__/__snapshots__/measure.test.tsx.snap b/packages/commands/measure/src/__tests__/__snapshots__/measure.test.tsx.snap index f0958ef3..cbf25089 100644 --- a/packages/commands/measure/src/__tests__/__snapshots__/measure.test.tsx.snap +++ b/packages/commands/measure/src/__tests__/__snapshots__/measure.test.tsx.snap @@ -12,11 +12,8 @@ Time taken to run the test. Can be helpful to measure Time To Interactive of your app, if the test is checking app start for instance. Average FPS 60 FPS -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -24,7 +21,7 @@ this video for more details Average CPU usage 83 % -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -859,7 +856,7 @@ exports[`flashlight measure interactive it displays measures: Web app with measu
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -3816,11 +3813,8 @@ Time taken to run the test. Can be helpful to measure Time To Interactive of your app, if the test is checking app start for instance. Average FPS - -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -3828,7 +3822,7 @@ this video for more details Average CPU usage - -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -4226,7 +4220,7 @@ exports[`flashlight measure interactive it displays measures: Web app with no me
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to diff --git a/packages/commands/measure/src/server/socket/socketState.ts b/packages/commands/measure/src/server/socket/socketState.ts index 26b4c5ff..945c633c 100644 --- a/packages/commands/measure/src/server/socket/socketState.ts +++ b/packages/commands/measure/src/server/socket/socketState.ts @@ -55,6 +55,9 @@ export const addNewResultReducer = (state: SocketData, name: string): SocketData name, iterations: [], status: "SUCCESS", + specs: { + refreshRate: state.refreshRate, + }, }, ], }); diff --git a/packages/commands/measure/src/webapp/MeasureWebApp.tsx b/packages/commands/measure/src/webapp/MeasureWebApp.tsx index 77abe7db..42d0b7dc 100644 --- a/packages/commands/measure/src/webapp/MeasureWebApp.tsx +++ b/packages/commands/measure/src/webapp/MeasureWebApp.tsx @@ -16,17 +16,8 @@ import { SocketState } from "./components/SocketState"; setThemeAtRandom(); export const MeasureWebApp = () => { - const { - autodetect, - bundleId, - start, - stop, - results, - isMeasuring, - reset, - setBundleId, - refreshRate, - } = useMeasures(); + const { autodetect, bundleId, start, stop, results, isMeasuring, reset, setBundleId } = + useMeasures(); return (
@@ -46,7 +37,7 @@ export const MeasureWebApp = () => {
) : null} - +
); }; diff --git a/packages/commands/report/src/App.tsx b/packages/commands/report/src/App.tsx index 80a76cd4..8c020f1b 100644 --- a/packages/commands/report/src/App.tsx +++ b/packages/commands/report/src/App.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { DeviceSpecs, TestCaseResult } from "@perf-profiler/types"; +import { TestCaseResult } from "@perf-profiler/types"; import { IterationsReporterView, PageBackground, @@ -13,10 +13,6 @@ let testCaseResults: TestCaseResult[] = // Use very long string so that Parcel won't use it more than once, would be nice to find a better solution "THIS_IS_A_VERY_LONG_STRING_THAT_IS_UNLIKELY_TO_BE_FOUND_IN_A_TEST_CASE_RESULT"; -const deviceSpecs: DeviceSpecs = { - refreshRate: 60, -}; - // Uncomment with when locally testing // // Without videos // testCaseResults = [ @@ -65,7 +61,7 @@ export function App() { return ( <> - + ); } diff --git a/packages/commands/test/src/SingleIterationTester.ts b/packages/commands/test/src/SingleIterationTester.ts index c97ebc95..e9245767 100644 --- a/packages/commands/test/src/SingleIterationTester.ts +++ b/packages/commands/test/src/SingleIterationTester.ts @@ -10,7 +10,7 @@ export interface TestCase { run: () => Promise | void; afterTest?: () => Promise | void; duration?: number; - getScore?: (result: AveragedTestCaseResult, refreshRate: number) => number; + getScore?: (result: AveragedTestCaseResult) => number; } export interface Options { diff --git a/packages/commands/test/src/writeReport.ts b/packages/commands/test/src/writeReport.ts index 393ac3ed..8315e07f 100644 --- a/packages/commands/test/src/writeReport.ts +++ b/packages/commands/test/src/writeReport.ts @@ -16,7 +16,7 @@ export const writeReport = ( }: { filePath: string; title: string; - overrideScore?: (result: AveragedTestCaseResult, refreshRate: number) => number; + overrideScore?: (result: AveragedTestCaseResult) => number; } ) => { const testCase: TestCaseResult = { @@ -34,7 +34,7 @@ export const writeReport = ( */ if (overrideScore) { const averagedResult: AveragedTestCaseResult = averageTestCaseResult(testCase); - testCase.score = Math.max(0, Math.min(overrideScore(averagedResult, 60), 100)); + testCase.score = Math.max(0, Math.min(overrideScore(averagedResult), 100)); } fs.writeFileSync(filePath, JSON.stringify(testCase)); diff --git a/packages/core/reporter/src/reporting/Report.ts b/packages/core/reporter/src/reporting/Report.ts index dd5b43c0..2445c18e 100644 --- a/packages/core/reporter/src/reporting/Report.ts +++ b/packages/core/reporter/src/reporting/Report.ts @@ -1,4 +1,4 @@ -import { TestCaseResult, AveragedTestCaseResult, DeviceSpecs } from "@perf-profiler/types"; +import { TestCaseResult, AveragedTestCaseResult } from "@perf-profiler/types"; import { roundToDecimal } from "../utils/round"; import { averageTestCaseResult } from "./averageIterations"; import { getScore } from "./getScore"; @@ -29,13 +29,11 @@ export class Report { private result: TestCaseResult; private averagedResult: AveragedTestCaseResult; private averageMetrics: ReportMetrics; - private deviceSpecs: DeviceSpecs; - constructor(result: TestCaseResult, deviceSpecs: DeviceSpecs) { + constructor(result: TestCaseResult) { this.result = Report.filterSuccessfulIterations(result); this.averagedResult = averageTestCaseResult(this.result); this.averageMetrics = Report.getAverageMetrics(this.averagedResult); - this.deviceSpecs = deviceSpecs; } private static getAverageMetrics(averagedResult: AveragedTestCaseResult): ReportMetrics { @@ -77,7 +75,7 @@ export class Report { } public get score() { - return this.averagedResult.score ?? getScore(this.averagedResult, this.deviceSpecs.refreshRate); + return this.averagedResult.score ?? getScore(this.averagedResult); } public getIterationCount() { @@ -93,13 +91,10 @@ export class Report { } public selectIteration(iterationIndex: number): Report { - return new Report( - { - ...this.result, - iterations: [this.result.iterations[iterationIndex]], - }, - this.deviceSpecs - ); + return new Report({ + ...this.result, + iterations: [this.result.iterations[iterationIndex]], + }); } public getAveragedResult() { @@ -122,4 +117,8 @@ export class Report { threads: getThreadsStats(iterations), }; } + + public getRefreshRate() { + return this.result.specs?.refreshRate ?? 60; + } } diff --git a/packages/core/reporter/src/reporting/getScore.ts b/packages/core/reporter/src/reporting/getScore.ts index 34e49622..644c8e01 100644 --- a/packages/core/reporter/src/reporting/getScore.ts +++ b/packages/core/reporter/src/reporting/getScore.ts @@ -13,7 +13,7 @@ import { canComputeHighCpuUsage } from "./highCpu"; */ const calculateCpuScore = (x: number) => Math.min(Math.max(0, -0.31666666666667 * x + 116), 100); -export const getScore = (result: AveragedTestCaseResult, refreshRate: number) => { +export const getScore = (result: AveragedTestCaseResult) => { const averageUIFPS = getAverageFPSUsage(result.average.measures); const averageCPUUsage = getAverageCpuUsage(result.average.measures); const totalTimeThreadlocked = Object.keys(result.averageHighCpuUsage).reduce( @@ -26,7 +26,7 @@ export const getScore = (result: AveragedTestCaseResult, refreshRate: number) => const scores = [cpuScore]; if (averageUIFPS !== undefined) { - const fpsScore = (averageUIFPS * 100) / refreshRate; + const fpsScore = (averageUIFPS * 100) / (result?.specs?.refreshRate ?? 60); scores.push(fpsScore); } diff --git a/packages/core/types/index.ts b/packages/core/types/index.ts index f397d8ba..d9f8a5df 100644 --- a/packages/core/types/index.ts +++ b/packages/core/types/index.ts @@ -39,6 +39,7 @@ export interface TestCaseResult { status: TestCaseResultStatus; iterations: TestCaseIterationResult[]; type?: TestCaseResultType; + specs?: DeviceSpecs; } export interface AveragedTestCaseResult { @@ -49,6 +50,7 @@ export interface AveragedTestCaseResult { average: TestCaseIterationResult; averageHighCpuUsage: { [processName: string]: number }; type?: TestCaseResultType; + specs?: DeviceSpecs; } // Shouldn't really be here but @perf-profiler/types is imported by everyone and doesn't contain any logic diff --git a/packages/core/web-reporter-ui/ReporterView.tsx b/packages/core/web-reporter-ui/ReporterView.tsx index 4226dfe5..ac4fe6ca 100644 --- a/packages/core/web-reporter-ui/ReporterView.tsx +++ b/packages/core/web-reporter-ui/ReporterView.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from "react"; -import { Measure, POLLING_INTERVAL, TestCaseResult, DeviceSpecs } from "@perf-profiler/types"; +import { Measure, POLLING_INTERVAL, TestCaseResult } from "@perf-profiler/types"; import { CPUReport } from "./src/sections/CPUReport"; import { ReportSummary } from "./src/sections/ReportSummary/ReportSummary.component"; import { RAMReport } from "./src/sections/RAMReport"; @@ -30,17 +30,12 @@ const theme = createTheme({ const Report = ({ results: rawResults, additionalMenuOptions, - deviceSpecs, }: { results: TestCaseResult[]; additionalMenuOptions?: MenuOption[]; - deviceSpecs: DeviceSpecs; }) => { const results = mapThreadNames(rawResults); - const reports = useMemo( - () => results.map((result) => new ReportModel(result, deviceSpecs)), - [results, deviceSpecs] - ); + const reports = useMemo(() => results.map((result) => new ReportModel(result)), [results]); const minIterationCount = Math.min(...reports.map((report) => report.getIterationCount())); const iterationSelector = useIterationSelector(minIterationCount); @@ -71,7 +66,7 @@ const Report = ({ ]} /> - +
{hasMeasures ? ( @@ -108,34 +103,21 @@ const Report = ({ export const IterationsReporterView = ({ results, additionalMenuOptions, - deviceSpecs, }: { results: TestCaseResult[]; additionalMenuOptions?: MenuOption[]; - deviceSpecs: DeviceSpecs; }) => { return results.length > 0 ? ( - + ) : null; }; -export const ReporterView = ({ - measures, - deviceSpecs, -}: { - measures: Measure[]; - deviceSpecs: DeviceSpecs; -}) => ( +export const ReporterView = ({ measures }: { measures: Measure[] }) => ( <> {measures.length > 1 ? ( ", () => { require("../../../commands/report/src/example-reports/results1.json"), require("../../../commands/report/src/example-reports/results2.json"), ]; - const deviceSpecs = { - refreshRate: 60, - }; const { asFragment, baseElement } = render( - + ); expect(screen.getAllByLabelText("Score")[0].textContent).toEqual("69"); @@ -50,12 +47,9 @@ describe("", () => { require("../../../commands/report/src/example-reports/video/results_417dd25e-d901-4b1e-9d43-3b78305a48e2.json"), require("../../../commands/report/src/example-reports/video/results_c7d5d17d-42ed-4354-8b43-bb26e2d6feee.json"), ]; - const deviceSpecs = { - refreshRate: 60, - }; const { asFragment, baseElement } = render( - + ); expect(screen.getAllByLabelText("Score")[0].textContent).toEqual("51"); diff --git a/packages/core/web-reporter-ui/__tests__/__snapshots__/ReporterView.test.tsx.snap b/packages/core/web-reporter-ui/__tests__/__snapshots__/ReporterView.test.tsx.snap index 5b62dcd2..cef377c0 100644 --- a/packages/core/web-reporter-ui/__tests__/__snapshots__/ReporterView.test.tsx.snap +++ b/packages/core/web-reporter-ui/__tests__/__snapshots__/ReporterView.test.tsx.snap @@ -31,11 +31,8 @@ Coefficient of variation : % Average FPS 59.7 FPS -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -65,7 +62,7 @@ Coefficient of variation : % Average CPU usage 58.6 % -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -210,11 +207,8 @@ Coefficient of variation : Average FPS 59.8 FPS (+0%) -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -245,7 +239,7 @@ Coefficient of variation : Average CPU usage 30.8 % (-47%) -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -2221,7 +2215,7 @@ exports[` renders the comparison view 2`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -2897,7 +2891,7 @@ exports[` renders the comparison view 2`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -14025,11 +14019,8 @@ Time taken to run the test. Can be helpful to measure Time To Interactive of your app, if the test is checking app start for instance. Average FPS 59.6 FPS -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -14037,7 +14028,7 @@ this video for more details Average CPU usage 66.1 % -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -14068,11 +14059,8 @@ Can be helpful to measure Time To Interactive of your app, if the test is checki Average FPS 59.9 FPS (+1%) -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -14081,7 +14069,7 @@ for more details Average CPU usage 30.9 % (-53%) -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -15597,7 +15585,7 @@ exports[` renders the comparison view 4`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -16030,7 +16018,7 @@ exports[` renders the comparison view 4`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -22018,11 +22006,8 @@ Coefficient of variation : % Average FPS 45.3 FPS -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -22052,7 +22037,7 @@ Coefficient of variation : % Average CPU usage 79.9 % -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -22228,11 +22213,8 @@ Coefficient of variation : Average FPS 38.2 FPS (-16%) -Frame Per Second. Your app should display -60 - Frames Per Second to give an impression of fluidity. This number should be close to -60 -, otherwise it will seem laggy. +Frame Per Second. Your app should display 60 Frames Per Second to give an impression of fluidity. This number should be close to 60, otherwise it will seem laggy. + See this video @@ -22263,7 +22245,7 @@ Coefficient of variation : Average CPU usage 92.8 % (+16%) -An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. +An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage. Depending on the device, this value can go up to 100% x number of cores . For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -23842,7 +23824,7 @@ exports[` renders the comparison view with videos 2`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to @@ -24561,7 +24543,7 @@ exports[` renders the comparison view with videos 2`] = `
- An app might run at 60FPS but might be using too much processing power, so it's important to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to diff --git a/packages/core/web-reporter-ui/src/sections/ReportSummary/Explanations.tsx b/packages/core/web-reporter-ui/src/sections/ReportSummary/Explanations.tsx index 032573da..4872a793 100644 --- a/packages/core/web-reporter-ui/src/sections/ReportSummary/Explanations.tsx +++ b/packages/core/web-reporter-ui/src/sections/ReportSummary/Explanations.tsx @@ -14,8 +14,8 @@ const AverageTestRuntimeExplanation = () => ( const AverageFPSExplanation = ({ refreshRate }: { refreshRate: number }) => ( <> - Frame Per Second. Your app should display {refreshRate} Frames Per Second to give an impression - of fluidity. This number should be close to {refreshRate}, otherwise it will seem laggy.
+ {`Frame Per Second. Your app should display ${refreshRate} Frames Per Second to give an impression of fluidity. This number should be close to ${refreshRate}, otherwise it will seem laggy.`}{" "} +
See{" "} this video @@ -26,8 +26,8 @@ const AverageFPSExplanation = ({ refreshRate }: { refreshRate: number }) => ( const AverageCPUUsageExplanation = () => ( <> - An app might run at 60FPS but might be using too much processing power, so it's important - to check CPU usage. + An app might run at high frame rates, such as 60 FPS or higher, but might be using too much + processing power, so it's important to check CPU usage.
Depending on the device, this value can go up to 100% x number of cores. For instance, a Samsung A10s has 4 cores, so the max value would be 400%. @@ -51,7 +51,13 @@ const AverageRAMUsageExplanation = () => ( ); -const HighCPUUsageExplanation = ({ result }: { result: AveragedTestCaseResult }) => ( +const HighCPUUsageExplanation = ({ + result, + refreshRate, +}: { + result: AveragedTestCaseResult; + refreshRate: number; +}) => ( <>

Impacted threads:

@@ -66,9 +72,7 @@ const HighCPUUsageExplanation = ({ result }: { result: AveragedTestCaseResult })

))}
- High CPU usage by a single process can cause app unresponsiveness, even with low overall CPU - usage. For instance, an overworked JS thread in a React Native app may lead to unresponsiveness - despite maintaining 60 FPS. + {`High CPU usage by a single process can cause app unresponsiveness, even with low overall CPU usage. For instance, an overworked JS thread in a React Native app may lead to unresponsiveness despite maintaining ${refreshRate} FPS.`} ); diff --git a/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummary.component.tsx b/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummary.component.tsx index 450b52b1..908165ad 100644 --- a/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummary.component.tsx +++ b/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummary.component.tsx @@ -3,15 +3,8 @@ import { ReportSummaryCard } from "./ReportSummaryCard"; import { getThemeColorPalette } from "../../theme/colors"; import { FailedReportSummaryCard } from "./FailedReportSummaryCard"; import { Report } from "@perf-profiler/reporter"; -import { DeviceSpecs } from "@perf-profiler/types"; -export const ReportSummary = ({ - reports, - deviceSpecs, -}: { - reports: Report[]; - deviceSpecs: DeviceSpecs; -}) => { +export const ReportSummary = ({ reports }: { reports: Report[] }) => { const palette = getThemeColorPalette(); const baselineReport = reports[0]; @@ -34,7 +27,6 @@ export const ReportSummary = ({ ) : ( )} diff --git a/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummaryCard.tsx b/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummaryCard.tsx index 76c56390..e9c0883b 100644 --- a/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummaryCard.tsx +++ b/packages/core/web-reporter-ui/src/sections/ReportSummary/ReportSummaryCard.tsx @@ -1,6 +1,5 @@ import React, { FunctionComponent } from "react"; import { Report, canComputeHighCpuUsage } from "@perf-profiler/reporter"; -import { DeviceSpecs } from "@perf-profiler/types"; import { ReportSummaryCardInfoRow } from "./ReportSummaryCardInfoRow"; import { Score } from "../../components/Score"; import { Explanations } from "./Explanations"; @@ -11,14 +10,9 @@ import { ThreadStats } from "./ThreadStats"; type Props = { report: Report; baselineReport?: Report; - deviceSpecs: DeviceSpecs; }; -export const ReportSummaryCard: FunctionComponent = ({ - report, - baselineReport, - deviceSpecs, -}) => { +export const ReportSummaryCard: FunctionComponent = ({ report, baselineReport }) => { const displayPlaceholder = !report.hasMeasures(); const metrics = report.getAverageMetrics(); const baselineMetrics = baselineReport?.getAverageMetrics(); @@ -66,7 +60,7 @@ export const ReportSummaryCard: FunctionComponent = ({ /> } explanation={ - + } statistics={ reportStats?.fps ? : undefined @@ -103,7 +97,12 @@ export const ReportSummaryCard: FunctionComponent = ({ baseline={baselineMetrics?.totalHighCpuTime} /> } - explanation={} + explanation={ + + } statistics={ reportStats ? ( <> diff --git a/packages/platforms/android/src/commands/detectCurrentDeviceRefreshRate.ts b/packages/platforms/android/src/commands/detectCurrentDeviceRefreshRate.ts index 06951c5e..6936828d 100644 --- a/packages/platforms/android/src/commands/detectCurrentDeviceRefreshRate.ts +++ b/packages/platforms/android/src/commands/detectCurrentDeviceRefreshRate.ts @@ -10,7 +10,7 @@ function deviceRefreshRateManager() { try { refreshRate = detectCurrentDeviceRefreshRate(); } catch (e) { - console.error(e); + Logger.error(`Could not detect device refresh rate: ${e}`); } }, }; diff --git a/packages/plugins/appium-test-cases/index.ts b/packages/plugins/appium-test-cases/index.ts index 2742ba8f..d3d45560 100644 --- a/packages/plugins/appium-test-cases/index.ts +++ b/packages/plugins/appium-test-cases/index.ts @@ -20,13 +20,13 @@ export const createStartAppTestCase = ({ driver.startApp(); await waitForAppStart(); }, - getScore: (result: AveragedTestCaseResult, refreshRate: number) => { + getScore: (result: AveragedTestCaseResult) => { /** * Startup time factor * * Cold start should be <= 5s */ const factor = (x: number) => (1 - (Math.atan((x - 1) / 5) / Math.PI) * 2) * 1.5; - return getScore(result, refreshRate) * factor(result.average.time / 1000); + return getScore(result) * factor(result.average.time / 1000); }, });