spacr.qt.laptop_mode¶
Run well on a small machine without becoming a smaller application.
This is the fallback reached after normal optimisations. It turns down decorative rendering costs instead of removing application features.
Nothing here changes what a run computes. Every setting it touches is about how the application is DRAWN.
It is chosen automatically, it can be overridden either way, and it says what it turned down – a mode that quietly makes the application different is one nobody can debug.
Functions¶
|
Turn the mode on or off. Returns what was decided and what changed. |
|
The whole decision as one block, for the launch log. |
|
What the decision is made from, so it can be reported and tested. |
|
What the environment says, or None when it says nothing. |
|
Physical memory in GiB, or None when it cannot be read. |
|
Cores this process may actually use, not cores the machine has. |
|
Whether to run in laptop mode, and the sentence that says why. |
|
Each thing the mode changes, and what a user loses by it. |
Module Contents¶
- spacr.qt.laptop_mode.apply(on: bool | None = None) Dict[str, object][source]¶
Turn the mode on or off. Returns what was decided and what changed.
- Parameters:
on – force the answer;
Nonemeasures the machine.- Returns:
{"on", "why", "changed"}–changednames each thing actually done, so a caller can say what happened rather than claim it.
NOTHING HERE IS PERSISTED. See
_NO_BACKDROPfor why: this is a decision about one run on one machine, and the user’s stored preference is not this module’s to answer.
- spacr.qt.laptop_mode.measure() Dict[str, object][source]¶
What the decision is made from, so it can be reported and tested.
- spacr.qt.laptop_mode.override() bool | None[source]¶
What the environment says, or None when it says nothing.
- spacr.qt.laptop_mode.total_memory_gib() float | None[source]¶
Physical memory in GiB, or None when it cannot be read.
- spacr.qt.laptop_mode.usable_cores() int[source]¶
Cores this process may actually use, not cores the machine has.
os.sched_getaffinitywhere it exists: a container or a scheduler can pin the process to fewer thancpu_countreports, and pinning is exactly the situation this mode is for.
- spacr.qt.laptop_mode.wanted(reading: Dict[str, object] | None = None) Tuple[bool, str][source]¶
Whether to run in laptop mode, and the sentence that says why.
- Returns:
(on, why). The reason is always populated, including when the answer is no – “spaCR decided not to” is a thing a user reports and somebody has to be able to check.
- spacr.qt.laptop_mode.what_it_turns_down() Tuple[Tuple[str, str], ...][source]¶
Each thing the mode changes, and what a user loses by it.
ONLY DRAWING. Nothing here is read by a pipeline, so a run computes the same answer in either mode – which is the promise that makes an automatic decision acceptable at all.