Vixen
02b45cc4
csharp
public sealed class LinuxPowerInfo

Battery, thermal pressure and the power profile, from sysfs.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Thermal state is the reason this exists. SDL reports the battery and cannot report how hot the machine is, and a quality-scaling policy that waits to notice frame times rise has already given the player the stutter it exists to prevent. Linux publishes thermal zones with the same trip points the kernel throttles on, which is a better signal than a temperature in degrees: 82 °C means nothing without knowing what this chassis considers hot, and "past the passive trip point" means exactly what Fair is defined as.

Read at most once a second. These are properties, they look free, and a policy that consults them per frame would do a dozen virtual-file-system round trips per frame to watch a number that changes on the scale of tens of seconds. The cache is the reason reading them in a hot loop is not a mistake.

Low-power mode is the ACPI platform profile. It is what power-profiles-daemon and the desktop's own battery menu write to, so it is the one place where "the user asked for less" is recorded regardless of which desktop asked.

Fields and properties (5)

  • public PowerSource Source

    Where power is coming from.

  • public float? BatteryLevel

    How full the battery is, [0, 1], or if there is no battery or the platform will not say.

  • public TimeSpan? EstimatedTimeRemaining

    What the portable implementation estimates.

  • public ThermalState Thermal

    How hot the device is.

  • public bool IsLowPowerMode

    Whether the user has asked the OS to save power.

Methods (1)

  • public LinuxPowerInfo(IPowerInfo fallback)

    Battery, thermal pressure and the power profile, from sysfs.

Used by (1)

  • LinuxPlatformSupplementVixen.Platform.Linux