Compare commits
2 commits
3310394fb8
...
60e9130891
Author | SHA1 | Date | |
---|---|---|---|
60e9130891 | |||
cedceeaf3c |
2 changed files with 28 additions and 13 deletions
|
@ -196,26 +196,37 @@ function OutfitMovieLayer({
|
||||||
let lastFpsLoggedAtInMs = performance.now();
|
let lastFpsLoggedAtInMs = performance.now();
|
||||||
let numFramesSinceLastLogged = 0;
|
let numFramesSinceLastLogged = 0;
|
||||||
const intervalId = setInterval(() => {
|
const intervalId = setInterval(() => {
|
||||||
updateStage();
|
|
||||||
|
|
||||||
numFramesSinceLastLogged++;
|
|
||||||
|
|
||||||
const now = performance.now();
|
const now = performance.now();
|
||||||
const timeSinceLastFpsLoggedAtInMs = now - lastFpsLoggedAtInMs;
|
const timeSinceLastFpsLoggedAtInMs = now - lastFpsLoggedAtInMs;
|
||||||
const timeSinceLastFpsLoggedAtInSec = timeSinceLastFpsLoggedAtInMs / 1000;
|
const timeSinceLastFpsLoggedAtInSec = timeSinceLastFpsLoggedAtInMs / 1000;
|
||||||
|
const fps = numFramesSinceLastLogged / timeSinceLastFpsLoggedAtInSec;
|
||||||
|
const roundedFps = Math.round(fps * 100) / 100;
|
||||||
|
|
||||||
if (timeSinceLastFpsLoggedAtInSec > 2) {
|
// If the page is visible, render the next frame, and track that we did.
|
||||||
const fps = numFramesSinceLastLogged / timeSinceLastFpsLoggedAtInSec;
|
// And if it's been 2 seconds since the last time we logged the FPS,
|
||||||
const roundedFps = Math.round(fps * 100) / 100;
|
// compute and log the FPS during those two seconds. (Checking the page
|
||||||
|
// visibility is both an optimization to avoid rendering the movie, but
|
||||||
|
// also makes "low FPS" tracking more accurate: browsers already throttle
|
||||||
|
// intervals when the page is hidden, so a low FPS is *expected*, and
|
||||||
|
// wouldn't indicate a performance problem like a low FPS normally would.)
|
||||||
|
if (!document.hidden) {
|
||||||
|
updateStage();
|
||||||
|
numFramesSinceLastLogged++;
|
||||||
|
|
||||||
console.debug(
|
if (timeSinceLastFpsLoggedAtInSec > 2) {
|
||||||
`[OutfitMovieLayer] FPS: ${roundedFps} (Target: ${targetFps}) (${libraryUrl})`,
|
console.debug(
|
||||||
);
|
`[OutfitMovieLayer] FPS: ${roundedFps} (Target: ${targetFps}) (${libraryUrl})`,
|
||||||
|
);
|
||||||
|
if (onLowFps && fps < 2) {
|
||||||
|
onLowFps(fps);
|
||||||
|
}
|
||||||
|
|
||||||
if (onLowFps && fps < 2) {
|
lastFpsLoggedAtInMs = now;
|
||||||
onLowFps(fps);
|
numFramesSinceLastLogged = 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Otherwise, if the page is hidden, keep resetting the FPS tracker
|
||||||
|
// state, to be able to pick up counting fresh once we come back.
|
||||||
lastFpsLoggedAtInMs = now;
|
lastFpsLoggedAtInMs = now;
|
||||||
numFramesSinceLastLogged = 0;
|
numFramesSinceLastLogged = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
# dev_ips
|
# dev_ips
|
||||||
- files/setup_secrets.yml
|
- files/setup_secrets.yml
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Set hostname to impress.openneo.net
|
||||||
|
hostname:
|
||||||
|
name: impress.openneo.net
|
||||||
|
|
||||||
- name: Create SSH folder for logged-in user
|
- name: Create SSH folder for logged-in user
|
||||||
become: no
|
become: no
|
||||||
file:
|
file:
|
||||||
|
|
Loading…
Reference in a new issue