Giter VIP home page Giter VIP logo

batenergy's Introduction

batenergy

Script to track laptop battery energy change during sleep states using systemd's system-sleep directory

Installation

This script should be copied to systemd's system-sleep directory. This directory is normally already present at /usr/lib/systemd/system-sleep or /lib/systemd/system-sleep; check your Linux distribution's information resources if it isn't clear which. Make sure it is executable (chmod +x batenergy.sh as needed).

Usage

Once installed, the script will cause informative output about battery energy change (amount and rate, in absolute units and percentages) to be added to the system logs. This information may be useful for troubleshooting both discharging and charging of the battery during sleep states.

Example output, accessible using, e.g., journalctl -u systemd-suspend.service:

systemd[1]: Starting System Suspend...
systemd-sleep[2096130]: Currently on battery.
systemd-sleep[2096130]: Saving time and battery energy before sleeping (suspend).
systemd-sleep[2096128]: Suspending system...
systemd-sleep[2096128]: System resumed.
systemd-sleep[2096235]: Currently on mains.
systemd-sleep[2096235]: Duration of 0 days 3 hours 26 minutes sleeping (suspend).
systemd-sleep[2096235]: Battery energy change of -4.5 % (-2320 mWh) at an average rate of -1.30 %/h (-673 mW).
systemd[1]: systemd-suspend.service: Deactivated successfully.
systemd[1]: Finished System Suspend.

Caveats

This script has been tested on one laptop model. I may have made assumptions that do not hold for yours; use at your own risk. Checking (for) the files referenced in the script (and other files in the containing directories) may help you adapt it to your model.

Credits

Inspired by Oliver Machacik's batdistrack.

batenergy's People

Contributors

equaeghe avatar ohmstance 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.