-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Support for High-FPS Readings in Flashlight for Devices Ove…
…r 60 FPS (#316) * feat: read refresh rate specs from adb shell * refactor(profiler): use a concise algorithm for extracting fps details Use regular expression to find all matches of fps details from the adb command response. A contrived algorithm was used previously, relying on different regex constructs to isolate sections of the adb response strings such as strings that had the following format - "refreshRate %d", "fps=%d". The "refreshRate" string was dropped for the more common "fps". chore(profiler): update base types with new method Adding detectDeviceRefreshRate method to the base and sub classes. An implementation templation that can be adopted across multiple platforms to provide GPU refresh rate of the devices being profiled * feat(webapp): send refresh rate to webapp from profiler by emiting an event in a socket * chore(web-reporter): pass refresh rate numbers to reporter ui chore: use device specs type A new device spec has been created for use to model device spec relevant to performance test: update snapshots and test cases * refactor: extract socket events into an enum * test: add unit test for verifying device refresh rate retrieval from ADB command refactor: remove unnecessary catch block * fix(profiler): accomodate varying refresh rate configurations Some devices come with the capabilities of switching between 60,90, 120 fps. The renderFrameRate reports the currently configured refresh rate. * test: add new specs for testing refresh rates on Pixels * 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 * refactor(sockets): place device refresh rates calls in start events
- Loading branch information
1 parent
59cb115
commit ae0bff0
Showing
24 changed files
with
261 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { io, Socket } from "socket.io-client"; | ||
import { ServerToClientEvents, ClientToServerEvents } from "../server/socket/socketInterface"; | ||
import { | ||
ServerToClientEvents, | ||
ClientToServerEvents, | ||
SocketEvents, | ||
} from "../server/socket/socketInterface"; | ||
|
||
export const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io( | ||
window.__FLASHLIGHT_DATA__.socketServerUrl | ||
); | ||
|
||
socket.on("disconnect", () => socket.close()); | ||
socket.on(SocketEvents.DISCONNECT, () => socket.close()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
import { useEffect, useState } from "react"; | ||
import type { SocketData } from "../server/socket/socketInterface"; | ||
import { SocketData, SocketEvents } from "../server/socket/socketInterface"; | ||
import { socket } from "./socket"; | ||
|
||
export const useMeasures = () => { | ||
const [state, setState] = useState<SocketData>(); | ||
|
||
useEffect(() => { | ||
socket.on("updateState", setState); | ||
socket.on(SocketEvents.UPDATE_STATE, setState); | ||
|
||
return () => { | ||
socket.off("updateState", setState); | ||
socket.off(SocketEvents.UPDATE_STATE, setState); | ||
}; | ||
}, []); | ||
|
||
return { | ||
bundleId: state?.bundleId ?? null, | ||
refreshRate: state?.refreshRate ?? 60, | ||
autodetect: () => { | ||
socket.emit("autodetectBundleId"); | ||
socket.emit(SocketEvents.AUTODETECT_BUNDLE_ID); | ||
socket.emit(SocketEvents.AUTODETECT_REFRESH_RATE); | ||
}, | ||
setBundleId: (bundleId: string) => { | ||
socket.emit("setBundleId", bundleId); | ||
socket.emit(SocketEvents.SET_BUNDLE_ID, bundleId); | ||
}, | ||
results: state?.results ?? [], | ||
isMeasuring: state?.isMeasuring ?? false, | ||
start: () => { | ||
socket.emit("start"); | ||
socket.emit(SocketEvents.START); | ||
}, | ||
stop: () => { | ||
socket.emit("stop"); | ||
socket.emit(SocketEvents.STOP); | ||
}, | ||
reset: () => { | ||
socket.emit("reset"); | ||
socket.emit(SocketEvents.RESET); | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.