okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-027-gh-app: GitHub app and Terminal items for 0.2.73cabb9e3f

main
945 B16 linesraw
1/**
2 * How often the host asks the graphics card driver for its readings (#4066).
3 * It used to start two nvidia-smi processes every 3 s for as long as the app was open, even with nothing loaded and
4 * the Monitor out of sight; on some PCs that was felt as a stutter while typing. Now the 3 s pace is kept while a model
5 * runs or the Monitor is being looked at, and an idle app asks once every 30 s.
6 */
7export const ACTIVE_MS = 3000;
8export const IDLE_MS = 30000;
9/** The Monitor screen asks again every 10 s while it is open; this is how long one ask keeps the fast pace. */
10export const WATCH_MS = 25000;
11
12/** `live`: a model is loaded or an engine runs. `watchedUntil`: ms timestamp until which the Monitor was last seen open. */
13export function sensorPace({ live = false, watchedUntil = 0, now = Date.now() } = {}) {
14  const watched = now < watchedUntil;
15  return { intervalMs: live || watched ? ACTIVE_MS : IDLE_MS, transfer: !!live };
16}