Hello everyone !

I have no idea if I’m in the right community, because it’s a mix of hardware and some light code/command to extract the power consumption out of my old laptop. I need some assistance and if someone way more intelligent than me could check the code and give feedback :)

Important infos

  • 12 year old ASUS N76 laptop
  • Bare bone server running Debian 12
  • No battery (died long time ago)
  • Running a dozens docker containers.

Because I have no battery connected to my laptop I’m unable to use tools like lm-sensors, powerstat, powertop. But from the following ressource I can estimate the power based on the Energy.

time=1
declare T0=($(sudo cat /sys/class/powercap/*/energy_uj)); sleep $time; declare T1=($(sudo cat /sys/class/powercap/*/energy_uj))
for i in "${!T0[@]}"; do echo - | awk "{printf \"%.1f W\", $((${T1[i]}-${T0[i]})) / $time / 1e6 }" ; done

While It effectively outputs something, I’m not sure if I can rely on that to estimate the power consumption.

Thanks :).

  • Doombot1@lemmy.one
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    If you’re not running with a battery, the maximum wattage of the charging brick should be shown on the brick itself. Either that or you can calculate it with P=I*V (amps * volts). That won’t give you what the laptop draws on average (likely much less than the calculated value) but it will give you a maximum.

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      It will give you the maximum of what the power supply is capable of providing which is nothing like what the laptop actually uses.

      • Still@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 year ago

        all the laptops I’ve ever had have been able to reliability pull the full power (like within 30 watts) of their power adapter rating so that’s a good estimate

        • N0x0n@lemmy.mlOP
          link
          fedilink
          arrow-up
          0
          ·
          1 year ago

          I’m not sure about that. Specially because it’s used as a bare bone server without any GUI with the lid closed. So it will draw way less power than showed on the charging brick.