okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
3cabb9e3f
main
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 () } = {}) { 14const watched = now < watchedUntil ; 15return { intervalMs :live || watched ?ACTIVE_MS :IDLE_MS , transfer :!! live }; 16}