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 :).

  • N0x0n@lemmy.mlOP
    link
    fedilink
    arrow-up
    0
    ·
    8 months ago

    This is probably the most precise way ! It feels a bit stupid to say… But I have actually no idea how to use that device :/… Maybe something I need to add to my toLearn list.

    Also, I’m trying to find my way arround linux and because everything is mathematically doable with the right values, a good estimate through a code/command is more convenient.

    • MrZee@lemm.ee
      link
      fedilink
      English
      arrow-up
      0
      ·
      8 months ago

      If you look for a “watt meter plug”, you’ll pribably understand what it is at a glance. It’s a device you plug into your wall outlet (or surge protector or whatever). It has a power outlet on it, which you plug your device into, and a screen that shows watts drawn and watt-hours over time. Super simple. I think “Kill A Watt” is the most well known brand.

    • fuckwit_mcbumcrumble@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      8 months ago

      Kill-a-watt is the most popular one. In the US they’re sold in harbor freight stores for like $30.

      I put that meter on everything. I love it.