Giter Club home page Giter Club logo

poweranalyzer's Introduction

batfetch - a bash script for better battery estimation

This is batfetch (former poweranalyser), a simple bash script to read the current battery discharging cycle and estimate the battery time left.

How to run

simply execute the bash script (sudo is not needed).

use batfetch -c 1 to analyse previous cycle

use batfetch --getcycles to see how many cycles are available to read

Example of output and explanation (my current reading):

Running on battery since 27/12/23 at 17:55:46 with 86%
until now (current cycle) with 27%
during this cycle the computer was sleeping for 18 hours, 18 minutes, 13 seconds

Running on battery for:         6 hours, 0 minutes, 25 seconds
Battery consumed:               59 %
Average power usage:            4.87562 W

Current power usage:            4.894 W (discharging)

Time to empty:                  2 hours, 45 minutes, 16 seconds
Battery cycle duration:         8 hours, 45 minutes, 41 seconds
Battery full-span:              10 hours, 10 minutes, 53 seconds

The output is as follows:

  • Running on battery for time running on battery (minus suspend and shutdown time, see notes)
  • Battery consumed the % of battery consumed in the analysed cycle
  • Average power usage average power consumption (calculated based on running on battery)
  • Current power usage power usage from ACPI (it might not be available in your system)
  • Time to empty available time running on battery
  • Battery cycle duration the full cycle duration since started running on battery until battery is empty
  • Battery full-span based on average, the full battery timespan

Notes

The Running on battery for calculates the time that the laptop has been running in battery by looking in the journalctl log for suspend and shutdown states. Therefore, this value does not account for the time that your laptopis not running (in suspended mode or shutdown). This seems to give a good and accurate calculation of the time remaining of the battery.

Work to do

This script has not been tested in many computers and distributions. I have used Arch Linux (Thinkpad Carbon X1 gen 9) and tested in Ubuntu (Asus Zenbook).

poweranalyzer's People

Contributors

ccouto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.