{"id":13840521,"url":"https://github.com/kevmitch/win_battery_log","last_synced_at":"2026-04-23T09:34:41.957Z","repository":{"id":77340701,"uuid":"54109453","full_name":"kevmitch/win_battery_log","owner":"kevmitch","description":"command line battery stats for MS Windows","archived":false,"fork":false,"pushed_at":"2016-03-17T18:05:09.000Z","size":23,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T05:29:43.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevmitch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-17T10:31:22.000Z","updated_at":"2021-12-21T20:18:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"acf0f0ca-e8cc-4dce-8f1c-c8db4bbc386e","html_url":"https://github.com/kevmitch/win_battery_log","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevmitch%2Fwin_battery_log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevmitch%2Fwin_battery_log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevmitch%2Fwin_battery_log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevmitch%2Fwin_battery_log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevmitch","download_url":"https://codeload.github.com/kevmitch/win_battery_log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242301098,"owners_count":20105361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T17:00:49.931Z","updated_at":"2026-04-23T09:34:41.895Z","avatar_url":"https://github.com/kevmitch.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"## win_battery_log\n\nThis is a small command line utility to measure and record battery statistics in\nMicrosoft Windows. It should report the battery capacity in milliwatt hours, the\nvoltage in millivolts, charge or discharge rate in milliwatts, and for each\nmeasurement, the number of seconds since recording began.\n\nIt was written to profile the power consumption of [mpv media\nplayer](https://github.com/mpv-player/mpv) using various hardware video decoding\nscenarios, but may be useful for development of other applications for which\nbattery conservation is important.\n\n## Usage\n\nWith no arguments, win_battery_log simply prints these statistics to the console\nevery two seconds until interrupted. So the command\n\n    win_battery_log\n\nWill return output like\n\n    time(s) capacity(mWh) voltage(mV) rate(mW)\n    0 79700 12674 -12521\n    2 79690 12640 -12437\n    4 79690 12659 -12418\n    6 79670 12673 -12394\n\nwin_battery_log can also be used to measure the battery statistics for the\nrunning duration of any command. Simply add that command, and its arguments as\narguments to win_battery_log itself. In this case, the statistics are written to\na log file named by sanitizing the commandline into a file-friendly name\nsuffixed by the Unix time in seconds and the \".log\" extension. win_battery_log\nwill automatically stop logging as soon as the command exits.\n\nFor example:\n\n    win_battery_log c:\\windows\\notepad.exe c:\\windows\\win.ini\n\nwill create a file called with the ugly, but functional name\n`c--windows-notepad.exe_c--windows-win.ini_0000000001458235621.log` with\ncontents similar to the output shown above.\n\n## Compilation\n\nwin_battery_log can be compiled using mingw-w64 in the\n[MSYS2](https://msys2.github.io/) environment, or as a\n[Cygwin](https://www.cygwin.com/) program. In the latter case, the path\nto the executable used as its second argument must still be in Windows (as\nopposed to Unix) format.\n\nOther than standard Windows libraries, win_battery_log should only depend on\nmake and a functioning c compiler (although it has only been tested with\ngcc). To build it, from inside the project root simply type\n\n    make\n\nTo remove the resulting executable and object files, as usual, it is sufficient\nto type\n\n    make clean\n\n## Bugs\n\n* It simply reports statistics on the first battery it finds. If you have\n  multiple batteries and you want to know other batteries, some\n  modifications to the source code may be necessary.\n\n* It is possible that your battery does not actually provide voltage or\n  discharge rate in comprehensible units. In MSDN terminology, the battery\n  reports only \"relative\" units. This will be reflected by the absense of units\n  in the output header. There's probably not more much that can be done about\n  this.\n\n* After the child process has ended, win_battery_log may take up to two seconds\n  to return to the command line. This is because it only checks if the program\n  is terminated every two seconds. It's no doubt possible to handle this better,\n  but the added complexity is probably not worth it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevmitch%2Fwin_battery_log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevmitch%2Fwin_battery_log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevmitch%2Fwin_battery_log/lists"}