Skip to main content

Custom UI - System compute pressure

· 2 min read
Stefan Benicke

Inform your users about their current system compute pressure. This way they know when it's time to reduce some background activity to keep the meeting running smoothly.

Initializing and Feature detection

Currently this feature is only available in Chromium based browsers like Chrome, Edge, and Opera since version 125. For more information about availabilty, see caniuse.com.

import { FeatureDetector, SystemPressureMonitor } from 'eyeson'

if (FeatureDetector.canMonitorSystemPressure()) {
startSystemPressureMonitor()
}

async function startSystemPressureMonitor() {
const monitor = new SystemPressureMonitor({ sampleInterval: 3000 })
monitor.onUpdate(state => {
console.log(`cpu pressure: ${state}`)
})
await monitor.start()
}

The sample interval is the requested sampling interval expressed in milliseconds. It defaults to 1000ms. We recommend setting it to some more seconds to avoid many quick switches.

End monitor

At the end of the meeting, when the observer is not needed anymore, it can be detroyed.

monitor.destroy()

Pressure states

The pressure state is defined as following.

nominal

The conditions of the target device are at an acceptable level with no noticeable adverse effects on the user.

fair

Target device pressure, temperature and/or energy usage are slightly elevated, potentially resulting in reduced battery-life, as well as fans (or systems with fans) becoming active and audible. Apart from that the target device is running flawlessly and can take on additional work.

serious

Target device pressure, temperature and/or energy usage is consistently highly elevated. The system may be throttling as a countermeasure to reduce thermals.

critical

The temperature of the target device or system is significantly elevated and it requires cooling down to avoid any potential issues.

Source: https://w3c.github.io/compute-pressure/#pressure-states

More information

Read more about all available functions in eyesonJS in the documentation.

Contact

We'll be happy to hear from you!

If you have a question or want to share any feedback, do not hesitate to create a ticket on GitHub.