Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active January 8, 2024 16:47
Show Gist options
  • Save CMCDragonkai/fba2cbc4d6e36ea80c513b0f0b9da6b8 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/fba2cbc4d6e36ea80c513b0f0b9da6b8 to your computer and use it in GitHub Desktop.
Power Measurement #cli

Power Measurement

When picking a laptop, power is really important!

Basically laptop chassis comes with usually a fixed battery capacity. So remember as you change your components, your battery usually won't get more energy available! In fact modifying the configuration can definitely reduce your battery life. Connecting components like keyboards and other USB devices will also increase the drain on your system.

Unfortunately companies don't seem to be willing to create a tool that estimates your power usage as you perform configuration. Instead we can use this tool: http://powersupplycalculator.net/

The battery capacity is usually shown in Whr which is a quantity based on wattage multiplied by hours. Common Whr for laptops are between 40 Whr (tiny 13 inch laptops) to 80 Whr (desktop replacement laptops).

To find out how long your computer will stay on, you need to divide Whr by the wattage used.

How do you know how much wattage is being used? It is surprisingly difficult to do this on machines that don't have batteries. If you do have a battery, your system will generally have ways of recording statistics.

Linux

Use upower --dump. This will show the energy capacity of your battery, and if you are running on batteries, you'll be able to see the current and voltage.

Or you can use:

cat /sys/class/power_supply/BAT0/voltage_now
cat /sys/class/power_supply/BAT0/current_now

And multiply them together. Remember the result will be in milliwatts.

The program powertop and powerstat will help you monitor power usage per program.

If you have an NVIDIA GPU, the nvidia-smi will also how your power usage.

Windows

Use powercfg /batteryreport.

Addendum

XPS 13 currently has 60 Whr.

My Eurocom P7 Pro has 80 Whr.

My Surface Book 1 has 18 Whr on battery 1 and 51 Whr on battery 2 for a total of 69 Whr. This is pretty amazing!

See: https://surfacetip.com/how-much-surface-battery-capacity-in-mah/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment