- From: Anssi Kostiainen via GitHub <sysbot+gh@w3.org>
- Date: Mon, 30 Jan 2023 14:35:05 +0000
- To: public-device-apis-log@w3.org
I think one way to engineer a solution to this could be to model this as a [rate-independent hysteresis](https://en.wikipedia.org/wiki/Hysteresis#Rate-independent). I.e. we only care about the (past) state and don't care about the time. Maybe this is easier to explain in pseudocode: When we're `"serious"`, transition to `"fair"` when `cpu` is less than 85: ``` if ((state == "serious") && (cpu < 85)) state = "fair"; ``` When we're `"fair"`, transition to `"serious"` when `cpu` is more than 90: ``` if ((state == "fair") && (cpu > 90)) state = "serious"; ``` Please note `cpu` is a placeholder for _some_ input received from the [platform collector](https://www.w3.org/TR/compute-pressure/#dfn-platform-collector) (likely not CPU utilization, because it has known issues). Also the values 85 and 90 are just placeholders for illustration purposes. This idea was inspired by a [nonideal relay](https://en.wikipedia.org/wiki/Preisach_model_of_hysteresis#Nonideal_relay): ![](https://upload.wikimedia.org/wikipedia/en/thumb/5/5e/Preisach_Relay.svg/640px-Preisach_Relay.svg.png) In this visual, `cpu` is the _x_ axis and state is the _y_ axis. `cpu` thresholds α and β map to 85 and 90 respectively in the pseudocode example. The state "serious" maps to y = 1 and "fair" to y = 0. With carefully chosen `cpu` metric and thresholds I believe this would avoid flip-flopping between pressure states. We could include some well-known algorithm like this in the spec as an informative note. Implementers are expected to tune their algorithms for various hardware, so keeping this algorithm informative will allow implementers to innovate and improve the quality of implementation over time with consideration for evolving workloads. -- GitHub Notification of comment by anssiko Please view or discuss this issue at https://github.com/w3c/compute-pressure/issues/176#issuecomment-1408731443 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 30 January 2023 14:35:07 UTC