wattop 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wattop-0.1.0/.gitignore +9 -0
- wattop-0.1.0/CHANGELOG.md +34 -0
- wattop-0.1.0/LICENSE +202 -0
- wattop-0.1.0/NOTICE +9 -0
- wattop-0.1.0/PKG-INFO +345 -0
- wattop-0.1.0/README.md +310 -0
- wattop-0.1.0/config.example.toml +123 -0
- wattop-0.1.0/packaging/README.md +107 -0
- wattop-0.1.0/packaging/aur/PKGBUILD +52 -0
- wattop-0.1.0/packaging/copr/wattop.spec +52 -0
- wattop-0.1.0/packaging/scoop/stamp.py +36 -0
- wattop-0.1.0/packaging/scoop/wattop.json +21 -0
- wattop-0.1.0/pyproject.toml +105 -0
- wattop-0.1.0/tests/conftest.py +79 -0
- wattop-0.1.0/tests/test_aggregates.py +142 -0
- wattop-0.1.0/tests/test_config.py +113 -0
- wattop-0.1.0/tests/test_derived.py +76 -0
- wattop-0.1.0/tests/test_linux_sources.py +143 -0
- wattop-0.1.0/tests/test_render.py +98 -0
- wattop-0.1.0/tests/test_ui.py +226 -0
- wattop-0.1.0/tests/test_win_energy_meter.py +91 -0
- wattop-0.1.0/wattop/__init__.py +3 -0
- wattop-0.1.0/wattop/cli.py +225 -0
- wattop-0.1.0/wattop/core/__init__.py +12 -0
- wattop-0.1.0/wattop/core/aggregates.py +286 -0
- wattop-0.1.0/wattop/core/channel.py +80 -0
- wattop-0.1.0/wattop/core/config.py +146 -0
- wattop-0.1.0/wattop/core/derived.py +121 -0
- wattop-0.1.0/wattop/core/registry.py +55 -0
- wattop-0.1.0/wattop/core/sampler.py +119 -0
- wattop-0.1.0/wattop/logging_sink.py +80 -0
- wattop-0.1.0/wattop/py.typed +0 -0
- wattop-0.1.0/wattop/render.py +330 -0
- wattop-0.1.0/wattop/sources/__init__.py +26 -0
- wattop-0.1.0/wattop/sources/_pdh.py +125 -0
- wattop-0.1.0/wattop/sources/generic.py +301 -0
- wattop-0.1.0/wattop/sources/linux_hwmon.py +157 -0
- wattop-0.1.0/wattop/sources/linux_power_supply.py +155 -0
- wattop-0.1.0/wattop/sources/linux_powercap.py +93 -0
- wattop-0.1.0/wattop/sources/linux_system.py +163 -0
- wattop-0.1.0/wattop/sources/win_battery.py +388 -0
- wattop-0.1.0/wattop/sources/win_energy_meter.py +197 -0
- wattop-0.1.0/wattop/sources/win_system.py +203 -0
- wattop-0.1.0/wattop/sources/win_thermal.py +90 -0
- wattop-0.1.0/wattop/ui/__init__.py +0 -0
- wattop-0.1.0/wattop/ui/app.py +693 -0
wattop-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to wattop are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- CPU and memory graphs, sourced from the Processor Information counterset and
|
|
11
|
+
`GlobalMemoryStatusEx` on Windows and from `/proc/stat` and `/proc/meminfo` on
|
|
12
|
+
Linux. Both emit the same channel keys, so the dashboard is the same screen on
|
|
13
|
+
either platform.
|
|
14
|
+
- `s` shows or hides the per-rail and per-zone sensor panels. `--details` starts
|
|
15
|
+
a run with them open; `show_details` in `config.toml` makes that the default.
|
|
16
|
+
- A test suite, and CI across Linux and Windows on both x86-64 and ARM64.
|
|
17
|
+
- Apache-2.0 licence, and packaging metadata good enough to publish.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Quitting could print a traceback: the poll timer kept firing during teardown
|
|
21
|
+
and repainted widgets that had already gone.
|
|
22
|
+
- `--list` reported rate-derived channels, such as processor utilisation, as a
|
|
23
|
+
flat zero. It took a single sample, which gave them no interval to divide by.
|
|
24
|
+
- A misspelled `group` or `role` in `[overrides]` was accepted silently, so the
|
|
25
|
+
channel was sampled and logged but never appeared on screen. It now warns.
|
|
26
|
+
- `rich` is declared as a dependency. It was imported directly by the dashboard
|
|
27
|
+
and happened to resolve only because Textual pulls it in.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- The Textual floor is now 2.1, which is the oldest release the dashboard has
|
|
31
|
+
actually been exercised against, rather than the 0.80 that was never tested.
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
- `block_graph` and its glyph tables, superseded by the braille renderer.
|
wattop-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Sravan Pannala
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
wattop-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
wattop
|
|
2
|
+
Copyright 2026 Sravan Pannala
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0. See the LICENSE file for the
|
|
5
|
+
full terms.
|
|
6
|
+
|
|
7
|
+
This product bundles no third-party source. At runtime it depends on Textual
|
|
8
|
+
and Rich (Textualize, MIT licensed), which are installed separately and are
|
|
9
|
+
not distributed as part of this work.
|
wattop-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: wattop
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: btop-style terminal power monitor: power in/out, volts and amps, per-rail SoC power
|
|
5
|
+
Project-URL: Homepage, https://github.com/sravanpannala/wattop
|
|
6
|
+
Project-URL: Repository, https://github.com/sravanpannala/wattop
|
|
7
|
+
Project-URL: Issues, https://github.com/sravanpannala/wattop/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/sravanpannala/wattop/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Sravan Pannala <sra.djoker@gmail.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: arm64,battery,energy,hwmon,monitor,power,rapl,sensors,snapdragon,terminal,tui,watts
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: System :: Hardware
|
|
26
|
+
Classifier: Topic :: System :: Monitoring
|
|
27
|
+
Classifier: Topic :: System :: Power (UPS)
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.11
|
|
30
|
+
Requires-Dist: rich>=13
|
|
31
|
+
Requires-Dist: textual>=2.1
|
|
32
|
+
Provides-Extra: parquet
|
|
33
|
+
Requires-Dist: pyarrow>=17; extra == 'parquet'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# wattop
|
|
37
|
+
|
|
38
|
+
A btop-style terminal power monitor: **power in, power out, volts and amps**, next to the processor
|
|
39
|
+
and memory load that explains them, plus whatever per-rail SoC power the machine is willing to tell
|
|
40
|
+
you about.
|
|
41
|
+
|
|
42
|
+
**No administrator rights, no kernel driver, no signed helper — on any platform.** That is the part
|
|
43
|
+
worth leading with. Every Windows tool that reports CPU power today goes through a ring-0 driver, and
|
|
44
|
+
the one they nearly all use now carries a published vulnerability and is a Defender signature. wattop
|
|
45
|
+
reads a performance counter and a device IOCTL, both as a normal user, at about 0.1 ms a sample.
|
|
46
|
+
|
|
47
|
+
It exists because of a gap on Windows specifically. Mainline btop on **Linux** does show battery and
|
|
48
|
+
CPU watts, and does it well; `btop4win` does not, because the watts code path was never ported —
|
|
49
|
+
it reads `GetSystemPowerStatus()`, which gives percent and time remaining and nothing else. `bottom`
|
|
50
|
+
shows battery watts on all three platforms but no volts, no amps, and no per-rail power. Neither has
|
|
51
|
+
a plugin system, so there is no way to add a sensor short of recompiling.
|
|
52
|
+
|
|
53
|
+
Windows on ARM is the sharpest case: Snapdragon laptops expose measured board-level power rails that
|
|
54
|
+
nothing else reads, and the tools people reach for either do not build for ARM64 or report no power
|
|
55
|
+
at all there.
|
|
56
|
+
|
|
57
|
+
**Prior art worth knowing about**, because wattop is not first and does not claim to be. On macOS,
|
|
58
|
+
[jolt](https://github.com/jordond/jolt), [macmon](https://github.com/vladkens/macmon) and
|
|
59
|
+
[mactop](https://github.com/context-labs/mactop) are all good, native, and better than wattop will be
|
|
60
|
+
there. On Linux, [s-tui](https://github.com/amanusk/s-tui) has graphed CPU watts for years. What none
|
|
61
|
+
of them do is Windows, and none of them graph a *measured* charger-input rail. See
|
|
62
|
+
[Where wattop fits](#where-wattop-fits).
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
╭─ OUT System ────────────────────────────────────────────────────────╮
|
|
66
|
+
│ 60.0 │
|
|
67
|
+
│ │
|
|
68
|
+
│ │
|
|
69
|
+
│ ⢀⣀⣠⣤⣶⣶⣤⣤⣀⣀ ⢀⣀⣤⣤⣴⣶⣤⣤⣤⣀⡀ ⢀⣠⣤⣤⣴⣴⣤⣤⣄⡀ │
|
|
70
|
+
│ ⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣤⣀⣀⣀⣀⢀⣀⣠⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣦⣤⣤⣤⣤⣴⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶│
|
|
71
|
+
│ ⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
72
|
+
│ 0.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
73
|
+
╰───────────────────────────────────────────────── 22.93 W ████░░░░░░ ─╯
|
|
74
|
+
╭─ BATT Battery ──────────────────────────────────────────────────────╮
|
|
75
|
+
│ 25.0 ⢀⣀ ⢀ │
|
|
76
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣷⣶⣷⣶⣶⣶⣴⣶⣤⣤⣤⣤⣄⣠⣀⣀⣀⢀⣀ │
|
|
77
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣶⣶⣤⣤⣤⣄⣀⡀⡀⡀ │
|
|
78
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣷⣶⣦⣴⣤⣄⣀ │
|
|
79
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣶⣤⣤⣀⣀⣀ │
|
|
80
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
81
|
+
│ 0.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
82
|
+
╰───────────────────────────────────────────────── +7.59 W ███░░░░░░░ ─╯
|
|
83
|
+
╭─ CPU Processor ─────────────────────────────────────────────────────╮
|
|
84
|
+
│ 100.0 ⣀⣠⣤⣀⡀ ⣀⣠⣄⣀⡀ ⣀⣠⣤⣀⡀ │
|
|
85
|
+
│ ⢀⣴⣾⣿⣿⣿⣿⣿⣶⣄ ⢀⣴⣾⣿⣿⣿⣿⣿⣶⣄ ⢀⣴⣾⣿⣿⣿⣿⣿⣶⣄ │
|
|
86
|
+
│ ⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀ ⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀ ⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄│
|
|
87
|
+
│ ⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⣀ ⢀⣀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣤⣤⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
88
|
+
│ 0.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
89
|
+
╰──────────────────────────────────────────────────── 47 % █████░░░░░ ─╯
|
|
90
|
+
╭─ MEM In use ────────────────────────────────────────────────────────╮
|
|
91
|
+
│ 15.6 │
|
|
92
|
+
│ ⣀⣀⣀⡀ ⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤│
|
|
93
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
94
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
95
|
+
│ 0.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
96
|
+
╰──────────────────────────────────────────────── 11.01 GB ███████░░░ ─╯
|
|
97
|
+
╭─ IN Charger in ─────────────────────────────────────────────────────╮
|
|
98
|
+
│ 60.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
99
|
+
│ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
100
|
+
│ 0.0 ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
101
|
+
╰───────────────────────────────────────────────── 59.45 W ██████████ ─╯
|
|
102
|
+
╭─ TEMP Hottest sensor ───────────────────────────────────────────────╮
|
|
103
|
+
│ 100.0 │
|
|
104
|
+
│ ⣀⣀⣀⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣄⣀⣀⣀⣀⣀⣤⣤⣤⣤⣤⣤⣤⣤⣶⣶⣶⣦⣶⣦⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣶⣤⣤⣤⣤⣤│
|
|
105
|
+
│ 40.0 ⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿│
|
|
106
|
+
╰─────────────────────────────────────────────── 69.3 degC █████░░░░░ ─╯
|
|
107
|
+
Voltage 8.630 V Current +5.220 A ██████████████░░░░ 78.6% 49.4/62.9 Wh charging
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Six graphs, three rows, in the order they earn: **OUT** and **BATT** are the two that actually move,
|
|
111
|
+
so they take the top row at 30% of the window each. **CPU** and **MEM** sit under them at 22%, since
|
|
112
|
+
what the machine is doing is the explanation for what it is drawing and the two want reading
|
|
113
|
+
together. **IN** and **TEMP** get 16% on the bottom row — the charger rail sits at its ceiling most
|
|
114
|
+
of the time and the hottest sensor moves slowly, so both are read as a number more often than as a
|
|
115
|
+
shape. Retune per role in `config.toml`:
|
|
116
|
+
|
|
117
|
+
```toml
|
|
118
|
+
[graphs]
|
|
119
|
+
power_out = 0.3
|
|
120
|
+
battery_power = 0.3
|
|
121
|
+
cpu = 0.2
|
|
122
|
+
memory = 0.2
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`--graph-height N` pins every graph instead.
|
|
126
|
+
|
|
127
|
+
The panel of per-rail power and per-zone temperatures under the graphs starts closed. Press `s` to
|
|
128
|
+
open it, `--details` to start a run with it open, or set `show_details = true` in `config.toml` to
|
|
129
|
+
make that the default. Closed is the default because on most machines those rows are a screenful of
|
|
130
|
+
numbers that rarely move, and they are rows the graphs wanted; the one thing they were read for at a
|
|
131
|
+
glance already survives as **TEMP**. Either way the channels are always sampled and always reach
|
|
132
|
+
`--list`, `--once`, `--json` and `--log`. If per-rail SoC power is the reason you are here, turn it
|
|
133
|
+
on and leave it on.
|
|
134
|
+
|
|
135
|
+
Every power graph is floored at zero on a fixed axis, so bar height means watts and one frame is
|
|
136
|
+
comparable to the last. **OUT** and **BATT** sit on a two-rung ladder: 0-25 W by default, which is
|
|
137
|
+
where the machine spends most of its life and where a single tall axis would squash everything into
|
|
138
|
+
the bottom third, and 0-60 W for as long as the window on screen holds a sample above 25 W. Each
|
|
139
|
+
picks its own rung from its own window, so a burst on one leaves the other where it was, and once
|
|
140
|
+
the burst scrolls off the axis drops back. **IN** keeps the ceiling its rail declares, and **CPU**
|
|
141
|
+
and **MEM** keep theirs: there is nothing above 100% of a processor and nothing above the RAM the
|
|
142
|
+
machine has, so both axes are the real limit rather than a guess, and the memory graph prints the
|
|
143
|
+
installed total as its top label. **TEMP** is the one graph that does not start at zero -- it runs a
|
|
144
|
+
fixed 40-100 degC, since the hottest sensor in a running machine never approaches zero and silicon
|
|
145
|
+
throttles just under 100, so the panel height is all live range and doubles as "how close to too
|
|
146
|
+
hot". Both bounds are printed on the axis, so what you are looking at is never ambiguous.
|
|
147
|
+
|
|
148
|
+
**BATT** plots magnitude — how hard the battery is working — and lets colour carry the direction:
|
|
149
|
+
amber discharging, green charging. Pin any ceiling you would rather set yourself with
|
|
150
|
+
`[overrides."<key>"] nominal_max`, and the ladder steps aside.
|
|
151
|
+
|
|
152
|
+
## What it can read
|
|
153
|
+
|
|
154
|
+
**Windows on a Snapdragon X Elite** — this is the good case. Windows surfaces the platform's EMI
|
|
155
|
+
(Energy Meter Interface) channels as ordinary performance counters, so the charger input rail is
|
|
156
|
+
*measured*, not inferred:
|
|
157
|
+
|
|
158
|
+
| Channel | Source |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `emi.PSU_USB` | power in, from the USB-C charger |
|
|
161
|
+
| `emi.SYS` | system rail |
|
|
162
|
+
| `emi.USBC_TOTAL`, `emi.CPU_CLUSTER_0..2`, `emi.GPU` | per-rail SoC power |
|
|
163
|
+
| `batt.power` / `.voltage` / `.current` / `.charge` / `.level` / `.temp` / `.cycles` | the battery device, via `IOCTL_BATTERY_QUERY_STATUS` |
|
|
164
|
+
| `batt.eta.avg` | time left, from battery watts averaged over a growing window |
|
|
165
|
+
| `cpu.util` | `% Processor Time` off the `Processor Information` counterset |
|
|
166
|
+
| `mem.used` / `mem.total` | physical memory, from `GlobalMemoryStatusEx` |
|
|
167
|
+
|
|
168
|
+
Battery `Rate` is signed, so discharging falls out of the sign and current is a real division rather
|
|
169
|
+
than an estimate. Everything works **without administrator rights** and costs about 0.1 ms a sample.
|
|
170
|
+
|
|
171
|
+
CPU is the not-idle fraction, the same thing btop counts and the same thing `/proc/stat` gives on
|
|
172
|
+
Linux. Windows also offers `% Processor Utility`, which scales that by the frequency actually
|
|
173
|
+
delivered -- it is what Task Manager shows, and it tracks the **OUT** graph more closely, because a
|
|
174
|
+
core parked at its lowest clock and never quite idle is 100% busy and a couple of watts. Measured on
|
|
175
|
+
this laptop, idling at about a third of nominal, Utility reads about a third of Time for the same
|
|
176
|
+
work. wattop shows Time anyway: a CPU number that disagrees three-to-one with every other load meter
|
|
177
|
+
on the machine costs more than the tighter correlation buys.
|
|
178
|
+
|
|
179
|
+
The one reading wattop computes rather than reads is **time left**. Windows will hand you a
|
|
180
|
+
`BatteryEstimatedTime`, but it is derived from the instantaneous rate, and an idle machine breathing
|
|
181
|
+
between 15 and 25 W makes that estimate swing by the better part of an hour from one second to the
|
|
182
|
+
next -- measured here, 55 minutes of swing across 45 seconds of sitting still. So `batt.eta.avg`
|
|
183
|
+
averages the *watts* over a window that grows to five minutes from the last plug/unplug and rolls
|
|
184
|
+
after that, and divides once. Averaging the rate rather than the estimate is the point: time left is
|
|
185
|
+
hyperbolic in power, so a single near-idle sample is an absurd ETA but an unremarkable watt figure.
|
|
186
|
+
The same average against the charging rate gives a time to full, which Windows does not offer at
|
|
187
|
+
all. Set `eta_window` in `config.toml` to trade steadiness against how fast it notices a new load.
|
|
188
|
+
|
|
189
|
+
**Linux** — `/sys/class/hwmon` is walked and everything found is exposed, so the headline number on
|
|
190
|
+
an AMD APU is `power1_average` from the `amdgpu` node (package power, the same PPT figure `ryzenadj`
|
|
191
|
+
reports, no root needed). RAPL via powercap is picked up when readable, and laptops additionally get
|
|
192
|
+
`/sys/class/power_supply`. CPU and memory come from `/proc/stat` and `/proc/meminfo` under the
|
|
193
|
+
same two keys the Windows pair uses, so the dashboard is the same screen on both.
|
|
194
|
+
|
|
195
|
+
Be aware of what a Ryzen AI Max+ 395 desktop **cannot** give you: no voltage or current anywhere
|
|
196
|
+
(Zen 5 uses SVI3 and no in-tree driver reads it), and no true "power in" (a desktop has no charger
|
|
197
|
+
rail, and the Framework EC exposes no PSU wattage). For real wall power there, point the
|
|
198
|
+
`http_json` source at a smart plug — see below.
|
|
199
|
+
|
|
200
|
+
## Where wattop fits
|
|
201
|
+
|
|
202
|
+
| | Windows | Linux | macOS |
|
|
203
|
+
|---|---|---|---|
|
|
204
|
+
| [btop](https://github.com/aristocratos/btop) | no build | battery + CPU watts | no watts |
|
|
205
|
+
| [btop4win](https://github.com/aristocratos/btop4win) | percent only, no watts | — | — |
|
|
206
|
+
| [bottom](https://github.com/ClementTsang/bottom) | battery watts, one static row | same | same |
|
|
207
|
+
| [jolt](https://github.com/jordond/jolt) | not supported | yes | best in class |
|
|
208
|
+
| [macmon](https://github.com/vladkens/macmon) / [mactop](https://github.com/context-labs/mactop) | — | — | yes |
|
|
209
|
+
| [s-tui](https://github.com/amanusk/s-tui) | — | CPU watts, graphed | — |
|
|
210
|
+
| **wattop** | **measured rails + battery, no admin, including ARM64** | hwmon / powercap / sysfs | **not supported** |
|
|
211
|
+
|
|
212
|
+
So the honest claim is not "the first power monitor in a terminal". It is four narrower things:
|
|
213
|
+
|
|
214
|
+
1. **Measured, not estimated.** The common fallback elsewhere is CPU percent multiplied by the
|
|
215
|
+
chip's rated power. wattop reads a hardware shunt, or shows nothing.
|
|
216
|
+
2. **Power *in*, not just power out.** The charger rail is a measured reading, so
|
|
217
|
+
`[[derived]] expr = "emi.PSU_USB - emi.SYS - batt.power"` gives you charger loss.
|
|
218
|
+
3. **Volts and amps**, which nothing else currently graphs in a terminal.
|
|
219
|
+
4. **No admin, no driver, anywhere.**
|
|
220
|
+
|
|
221
|
+
**macOS is not supported.** wattop runs there and exits cleanly saying it found no sensors. Adding it
|
|
222
|
+
would mean a fifth entrant into the one platform that is already well served; the tools above are
|
|
223
|
+
native code and sudoless and get it right. Use one of those.
|
|
224
|
+
|
|
225
|
+
## Install
|
|
226
|
+
|
|
227
|
+
```console
|
|
228
|
+
$ uvx wattop # run it without installing anything
|
|
229
|
+
$ uv tool install wattop # or keep it on PATH
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
[uv](https://docs.astral.sh/uv/) installs its own Python, so this works on a machine with none. If
|
|
233
|
+
you would rather use what you have, `pipx install wattop` and `pip install wattop` both work; wattop
|
|
234
|
+
needs Python 3.11 or newer.
|
|
235
|
+
|
|
236
|
+
There is one wheel and it is `py3-none-any` — the same file serves Windows x64 and ARM64, Linux
|
|
237
|
+
x86-64 and aarch64, with no compiled extension anywhere.
|
|
238
|
+
|
|
239
|
+
Optional: `wattop[parquet]` logs to Parquet instead of CSV. It has no Windows ARM64 wheel, so on a
|
|
240
|
+
Snapdragon machine stick to CSV.
|
|
241
|
+
|
|
242
|
+
### From source
|
|
243
|
+
|
|
244
|
+
```console
|
|
245
|
+
$ git clone https://github.com/sravanpannala/wattop && cd wattop
|
|
246
|
+
$ uv sync && uv run wattop
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
On Windows ARM64, pin the native interpreter explicitly — `uv` itself is an x86_64 build and will
|
|
250
|
+
otherwise hand you an emulated Python:
|
|
251
|
+
|
|
252
|
+
```console
|
|
253
|
+
$ uv venv --python cpython-3.12-windows-aarch64
|
|
254
|
+
$ uv sync
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Usage
|
|
258
|
+
|
|
259
|
+
```console
|
|
260
|
+
$ wattop # the live dashboard
|
|
261
|
+
$ wattop --list # every channel discovered, with its group and role
|
|
262
|
+
$ wattop --once # one snapshot, then exit
|
|
263
|
+
$ wattop --once --json # ... as JSON, for a script or an OSD
|
|
264
|
+
$ wattop --json -n 60 # a stream of JSON lines
|
|
265
|
+
$ wattop --log power.csv # append samples to CSV (or .parquet with the extra)
|
|
266
|
+
$ wattop --details # start with the per-rail sensor panels open
|
|
267
|
+
$ wattop -i 0.25 # faster sampling
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
In the TUI: `q` quit, `p` pause, `s` show or hide the per-rail and per-zone sensor panels,
|
|
271
|
+
`+`/`-` change the interval.
|
|
272
|
+
|
|
273
|
+
`--once` takes about two seconds on Windows, nearly all of it waiting for the performance counters to
|
|
274
|
+
advance — a rate counter yields nothing until a second sample exists, and that is the data source's
|
|
275
|
+
floor, not Python's. Fine for a script or a log; too slow for a shell prompt that runs it every
|
|
276
|
+
command.
|
|
277
|
+
|
|
278
|
+
`--log` writes its header from the channels discovered at startup and skips it when the file
|
|
279
|
+
already has one, so start a new file rather than appending to a log written before a machine
|
|
280
|
+
grew a sensor -- the new columns land in the middle of the row, not at the end.
|
|
281
|
+
|
|
282
|
+
## Adding a reading
|
|
283
|
+
|
|
284
|
+
The UI never names a sensor. It lays out by **group** (`in`, `out`, `battery`, `system`, `rails`,
|
|
285
|
+
`thermal`) and headlines whatever fills each **role** (`power_in`, `power_out`, `battery_power`,
|
|
286
|
+
`battery_voltage`, `battery_current`, `battery_charge`, `battery_level`, `battery_eta`, `ac_online`,
|
|
287
|
+
`temperature`, `cpu`, `memory`). So a new reading only ever needs to declare where it belongs, and
|
|
288
|
+
the display follows. `rails` and `thermal` are sampled but not drawn, so anything you want on
|
|
289
|
+
screen wants one of the other groups or a role -- including a rail you miss, which
|
|
290
|
+
`[overrides."emi.GPU"] group = "other"` puts back.
|
|
291
|
+
|
|
292
|
+
That makes adding one come in three sizes.
|
|
293
|
+
|
|
294
|
+
**1. Nothing.** A new instance of an already-wrapped source is discovered on its own — another
|
|
295
|
+
`Energy Meter` rail after a firmware update, another `hwmon` node after a kernel bump.
|
|
296
|
+
|
|
297
|
+
**2. A config stanza.** Copy `config.example.toml` to `config.toml` (or
|
|
298
|
+
`~/.config/wattop/config.toml`, or `%APPDATA%\wattop\config.toml`):
|
|
299
|
+
|
|
300
|
+
```toml
|
|
301
|
+
[[sensor]]
|
|
302
|
+
source = "http_json" # a Tasmota smart plug: real wall watts
|
|
303
|
+
url = "http://plug.lan/cm?cmnd=Status%2010"
|
|
304
|
+
pointer = "/StatusSNS/ENERGY/Power"
|
|
305
|
+
key = "wall"; label = "Wall"; unit = "W"; group = "in"; role = "power_in"
|
|
306
|
+
|
|
307
|
+
[[derived]]
|
|
308
|
+
key = "efficiency"; label = "Charger loss"; unit = "W"; group = "other"
|
|
309
|
+
expr = "emi.PSU_USB - emi.SYS - batt.power"
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Generic sources: `sysfs` (a number in a file), `exec` (a command), `http_json` (an endpoint),
|
|
313
|
+
`pdh` (any Windows performance counter, wildcards included). `[[derived]]` computes channels from
|
|
314
|
+
other channels; `[overrides."key"]` relabels or regroups a built-in one.
|
|
315
|
+
|
|
316
|
+
**3. A new file in `wattop/sources/`.** Only needed for a genuinely new OS API. Implement four
|
|
317
|
+
methods, add `@register`, and change nothing else:
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
@register
|
|
321
|
+
class MySource:
|
|
322
|
+
name = "my_source"
|
|
323
|
+
def available(self) -> bool: ... # cheap probe; False means "skip me quietly"
|
|
324
|
+
def channels(self) -> list[Channel]: ...
|
|
325
|
+
def read(self) -> dict[str, float]: ...
|
|
326
|
+
def close(self) -> None: ...
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
A source that fails to construct, discover or read is logged and skipped — a broken sensor never
|
|
330
|
+
costs you the rest of the dashboard. Run with `--debug` to see what declined and why.
|
|
331
|
+
|
|
332
|
+
## Layout
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
wattop/core/ Channel + Source protocol, registry, sampler, config, derived expressions
|
|
336
|
+
wattop/sources/ win_energy_meter, win_battery, win_thermal, win_system,
|
|
337
|
+
linux_hwmon, linux_powercap, linux_power_supply, linux_system,
|
|
338
|
+
generic (sysfs/exec/http_json/pdh)
|
|
339
|
+
wattop/ui/ the Textual dashboard
|
|
340
|
+
wattop/render.py sparklines, bars, the text tables used by --list and --once
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Licence
|
|
344
|
+
|
|
345
|
+
Apache-2.0. See [LICENSE](LICENSE).
|