mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 08:57:46 +00:00
treewide: finish renaming to Watt (#36)
This commit is contained in:
commit
d33659209e
14 changed files with 132 additions and 132 deletions
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
|
@ -30,11 +30,11 @@ jobs:
|
|||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
name: superfreq-linux-amd64
|
||||
name: watt-linux-amd64
|
||||
cross: false
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
name: superfreq-linux-arm64
|
||||
name: watt-linux-arm64
|
||||
cross: true
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
@ -88,12 +88,12 @@ jobs:
|
|||
uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
tag: ${{ github.ref_name }}
|
||||
fileName: "superfreq-*"
|
||||
fileName: "watt-*"
|
||||
out-file-path: "."
|
||||
|
||||
- name: Generate checksums
|
||||
run: |
|
||||
sha256sum superfreq-* > SHA256SUMS
|
||||
sha256sum watt-* > SHA256SUMS
|
||||
|
||||
- name: Upload Checksums
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
|
98
Cargo.lock
generated
98
Cargo.lock
generated
|
@ -13,9 +13,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.18"
|
||||
version = "0.6.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
|
@ -28,36 +28,36 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.10"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.7"
|
||||
version = "3.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
|
||||
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
|
@ -69,9 +69,9 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
|||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.0"
|
||||
version = "2.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
||||
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -87,9 +87,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.38"
|
||||
version = "4.5.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000"
|
||||
checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -97,9 +97,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.38"
|
||||
version = "4.5.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120"
|
||||
checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -127,9 +127,9 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
|||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
|
@ -216,9 +216,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
|
@ -238,9 +238,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
|||
|
||||
[[package]]
|
||||
name = "jiff"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f02000660d30638906021176af16b17498bd0d12813dbfe7b276d8bc7f3c0806"
|
||||
checksum = "a194df1107f33c79f4f93d02c80798520551949d59dfad22b6157048a88cca93"
|
||||
dependencies = [
|
||||
"jiff-static",
|
||||
"jiff-tzdb-platform",
|
||||
|
@ -253,9 +253,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "jiff-static"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3c30758ddd7188629c6713fc45d1188af4f44c90582311d0c8d8c9907f60c48"
|
||||
checksum = "6c6e1db7ed32c6c71b759497fae34bf7933636f75a251b9e736555da426f6442"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -319,19 +319,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
name = "once_cell_polyfill"
|
||||
version = "1.70.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
|
@ -341,9 +341,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
|||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.11.0"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
||||
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic-util"
|
||||
|
@ -447,23 +447,6 @@ version = "0.11.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "superfreq"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"ctrlc",
|
||||
"dirs",
|
||||
"env_logger",
|
||||
"jiff",
|
||||
"log",
|
||||
"num_cpus",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.101"
|
||||
|
@ -554,6 +537,23 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "watt"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"ctrlc",
|
||||
"dirs",
|
||||
"env_logger",
|
||||
"jiff",
|
||||
"log",
|
||||
"num_cpus",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "superfreq"
|
||||
name = "watt"
|
||||
description = "Modern CPU frequency and power management utility for Linux"
|
||||
version = "0.3.2"
|
||||
edition = "2024"
|
||||
|
|
76
README.md
76
README.md
|
@ -1,5 +1,5 @@
|
|||
<h1 id="header" align="center">
|
||||
Superfreq
|
||||
Watt
|
||||
</h1>
|
||||
|
||||
<div align="center">
|
||||
|
@ -8,15 +8,15 @@
|
|||
|
||||
<div align="center">
|
||||
<br/>
|
||||
<a href="#what-is-superfreq">Synopsis</a><br/>
|
||||
<a href="#what-is-watt">Synopsis</a><br/>
|
||||
<a href="#features">Features</a> | <a href="#usage">Usage</a><br/>
|
||||
<a href="#contributing">Contributing</a>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
## What is Superfreq
|
||||
## What is Watt
|
||||
|
||||
Superfreq is a modern CPU frequency and power management utility for Linux
|
||||
Watt is a modern CPU frequency and power management utility for Linux
|
||||
systems. It provides intelligent control of CPU governors, frequencies, and
|
||||
power-saving features, helping optimize both performance and battery life.
|
||||
|
||||
|
@ -48,81 +48,81 @@ but most common usecases are already implemented.
|
|||
|
||||
```bash
|
||||
# Show current system information
|
||||
superfreq info
|
||||
watt info
|
||||
|
||||
# Run as a daemon in the background
|
||||
sudo superfreq daemon
|
||||
sudo watt daemon
|
||||
|
||||
# Run with verbose logging
|
||||
sudo superfreq daemon --verbose
|
||||
sudo watt daemon --verbose
|
||||
|
||||
# Display comprehensive debug information
|
||||
superfreq debug
|
||||
watt debug
|
||||
```
|
||||
|
||||
### CPU Governor Control
|
||||
|
||||
```bash
|
||||
# Set CPU governor for all cores
|
||||
sudo superfreq set-governor performance
|
||||
sudo watt set-governor performance
|
||||
|
||||
# Set CPU governor for a specific core
|
||||
sudo superfreq set-governor powersave --core-id 0
|
||||
sudo watt set-governor powersave --core-id 0
|
||||
|
||||
# Force a specific governor mode persistently
|
||||
sudo superfreq force-governor performance
|
||||
sudo watt force-governor performance
|
||||
```
|
||||
|
||||
### Turbo Boost Management
|
||||
|
||||
```bash
|
||||
# Always enable turbo boost
|
||||
sudo superfreq set-turbo always
|
||||
sudo watt set-turbo always
|
||||
|
||||
# Disable turbo boost
|
||||
sudo superfreq set-turbo never
|
||||
sudo watt set-turbo never
|
||||
|
||||
# Let Superfreq manage turbo boost based on conditions
|
||||
sudo superfreq set-turbo auto
|
||||
# Let Watt manage turbo boost based on conditions
|
||||
sudo watt set-turbo auto
|
||||
```
|
||||
|
||||
### Power and Performance Settings
|
||||
|
||||
```bash
|
||||
# Set Energy Performance Preference (EPP)
|
||||
sudo superfreq set-epp performance
|
||||
sudo watt set-epp performance
|
||||
|
||||
# Set Energy Performance Bias (EPB)
|
||||
sudo superfreq set-epb 4
|
||||
sudo watt set-epb 4
|
||||
|
||||
# Set ACPI platform profile
|
||||
sudo superfreq set-platform-profile balanced
|
||||
sudo watt set-platform-profile balanced
|
||||
```
|
||||
|
||||
### Frequency Control
|
||||
|
||||
```bash
|
||||
# Set minimum CPU frequency (in MHz)
|
||||
sudo superfreq set-min-freq 800
|
||||
sudo watt set-min-freq 800
|
||||
|
||||
# Set maximum CPU frequency (in MHz)
|
||||
sudo superfreq set-max-freq 3000
|
||||
sudo watt set-max-freq 3000
|
||||
|
||||
# Set per-core frequency limits
|
||||
sudo superfreq set-min-freq 1200 --core-id 0
|
||||
sudo superfreq set-max-freq 2800 --core-id 1
|
||||
sudo watt set-min-freq 1200 --core-id 0
|
||||
sudo watt set-max-freq 2800 --core-id 1
|
||||
```
|
||||
|
||||
### Battery Management
|
||||
|
||||
```bash
|
||||
# Set battery charging thresholds to extend battery lifespan
|
||||
sudo superfreq set-battery-thresholds 40 80 # Start charging at 40%, stop at 80%
|
||||
sudo watt set-battery-thresholds 40 80 # Start charging at 40%, stop at 80%
|
||||
```
|
||||
|
||||
Battery charging thresholds help extend battery longevity by preventing constant
|
||||
charging to 100%. Different laptop vendors implement this feature differently,
|
||||
but Superfreq attempts to support multiple vendor implementations including:
|
||||
but Watt attempts to support multiple vendor implementations including:
|
||||
|
||||
- Lenovo ThinkPad/IdeaPad (Standard implementation)
|
||||
- ASUS laptops
|
||||
|
@ -135,12 +135,12 @@ more than issue reports, as supporting hardware _needs_ hardware.
|
|||
|
||||
## Configuration
|
||||
|
||||
Superfreq uses TOML configuration files. Default locations:
|
||||
Watt uses TOML configuration files. Default locations:
|
||||
|
||||
- `/etc/xdg/superfreq/config.toml`
|
||||
- `/etc/superfreq.toml`
|
||||
- `/etc/xdg/watt/config.toml`
|
||||
- `/etc/watt.toml`
|
||||
|
||||
You can also specify a custom path by setting the `SUPERFREQ_CONFIG` environment
|
||||
You can also specify a custom path by setting the `WATT_CONFIG` environment
|
||||
variable.
|
||||
|
||||
### Sample Configuration
|
||||
|
@ -214,7 +214,7 @@ throttle_on_battery = true
|
|||
# Logging level: Error, Warning, Info, Debug
|
||||
log_level = "Info"
|
||||
# Optional stats file path
|
||||
stats_file_path = "/var/run/superfreq-stats"
|
||||
stats_file_path = "/var/run/watt-stats"
|
||||
|
||||
# Optional: List of power supplies to ignore
|
||||
[power_supply_ignore_list]
|
||||
|
@ -224,13 +224,13 @@ mouse_battery = "hid-12:34:56:78:90:ab-battery"
|
|||
|
||||
## Advanced Features
|
||||
|
||||
Those are the more advanced features of Superfreq that some users might be more
|
||||
Those are the more advanced features of Watt that some users might be more
|
||||
inclined to use than others. If you have a use-case that is not covered, please
|
||||
create an issue.
|
||||
|
||||
### Dynamic Turbo Boost Management
|
||||
|
||||
When using `turbo = "auto"` with `enable_auto_turbo = true`, Superfreq
|
||||
When using `turbo = "auto"` with `enable_auto_turbo = true`, Watt
|
||||
dynamically controls CPU turbo boost based on:
|
||||
|
||||
- **CPU Load Thresholds**: Enables turbo when load exceeds `load_threshold_high`
|
||||
|
@ -260,16 +260,16 @@ The table below explains how different combinations of `turbo` and
|
|||
| ------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `turbo = "always"` | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature |
|
||||
| `turbo = "never"` | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature |
|
||||
| `turbo = "auto"` | **Dynamically managed**<br>Superfreq enables/disables turbo based on CPU load and temperature thresholds | **System default**<br>Turbo is reset to system's default enabled state and is managed by the hardware/kernel |
|
||||
| `turbo = "auto"` | **Dynamically managed**<br>Watt enables/disables turbo based on CPU load and temperature thresholds | **System default**<br>Turbo is reset to system's default enabled state and is managed by the hardware/kernel |
|
||||
|
||||
> [!NOTE]
|
||||
> When `turbo = "auto"` and `enable_auto_turbo = false`, Superfreq ensures that
|
||||
> When `turbo = "auto"` and `enable_auto_turbo = false`, Watt ensures that
|
||||
> any previous turbo state restrictions are removed, allowing the
|
||||
> hardware/kernel to manage turbo behavior according to its default algorithms.
|
||||
|
||||
### Adaptive Polling
|
||||
|
||||
Superfreq includes a "sophisticated" (euphemism for complicated) adaptive
|
||||
Watt includes a "sophisticated" (euphemism for complicated) adaptive
|
||||
polling system to try and maximize power efficiency
|
||||
|
||||
- **Battery Discharge Analysis** - Automatically adjusts polling frequency based
|
||||
|
@ -294,7 +294,7 @@ idle periods, while maintaining responsiveness when needed.
|
|||
|
||||
### Power Supply Filtering
|
||||
|
||||
Configure Superfreq to ignore certain power supplies (like peripheral batteries)
|
||||
Configure Watt to ignore certain power supplies (like peripheral batteries)
|
||||
that might interfere with power state detection.
|
||||
|
||||
## Troubleshooting
|
||||
|
@ -319,11 +319,11 @@ Not all features are available on all hardware:
|
|||
2. **CPU frequencies fluctuating**: May be due to thermal throttling
|
||||
3. **Missing CPU information**: Verify kernel module support for your CPU
|
||||
|
||||
While reporting issues, please attach the results from `superfreq debug`.
|
||||
While reporting issues, please attach the results from `watt debug`.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to Superfreq are always welcome! Whether it's bug reports, feature
|
||||
Contributions to Watt are always welcome! Whether it's bug reports, feature
|
||||
requests, or code contributions, please feel free to contribute.
|
||||
|
||||
> [!NOTE]
|
||||
|
@ -357,5 +357,5 @@ before committing to catch possible code smell early.
|
|||
|
||||
## License
|
||||
|
||||
Superfreq is available under [Mozilla Public License v2.0](LICENSE) for your
|
||||
Watt is available under [Mozilla Public License v2.0](LICENSE) for your
|
||||
convenience, and at our expense. Please see the license file for more details.
|
||||
|
|
14
flake.nix
14
flake.nix
|
@ -14,16 +14,16 @@
|
|||
});
|
||||
in {
|
||||
overlays = {
|
||||
superfreq = final: _: {
|
||||
superfreq = final.callPackage ./nix/package.nix {};
|
||||
watt = final: _: {
|
||||
watt = final.callPackage ./nix/package.nix {};
|
||||
};
|
||||
default = self.overlays.superfreq;
|
||||
default = self.overlays.watt;
|
||||
};
|
||||
|
||||
packages =
|
||||
nixpkgs.lib.mapAttrs (system: pkgs: {
|
||||
inherit (pkgs) superfreq;
|
||||
default = self.packages.${system}.superfreq;
|
||||
inherit (pkgs) watt;
|
||||
default = self.packages.${system}.watt;
|
||||
})
|
||||
pkgsForEach;
|
||||
|
||||
|
@ -34,8 +34,8 @@
|
|||
pkgsForEach;
|
||||
|
||||
nixosModules = {
|
||||
superfreq = import ./nix/module.nix inputs;
|
||||
default = self.nixosModules.superfreq;
|
||||
watt = import ./nix/module.nix inputs;
|
||||
default = self.nixosModules.watt;
|
||||
};
|
||||
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
|
|
|
@ -10,32 +10,32 @@ inputs: {
|
|||
inherit (lib.lists) optional;
|
||||
inherit (lib.meta) getExe;
|
||||
|
||||
cfg = config.services.superfreq;
|
||||
cfg = config.services.watt;
|
||||
|
||||
format = pkgs.formats.toml {};
|
||||
cfgFile = format.generate "superfreq-config.toml" cfg.settings;
|
||||
cfgFile = format.generate "watt-config.toml" cfg.settings;
|
||||
in {
|
||||
options.services.superfreq = {
|
||||
options.services.watt = {
|
||||
enable = mkEnableOption "Automatic CPU speed & power optimizer for Linux";
|
||||
package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "superfreq" {
|
||||
package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "watt" {
|
||||
pkgsText = "self.packages.\${pkgs.stdenv.system}";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = {};
|
||||
type = submodule {freeformType = format.type;};
|
||||
description = "Configuration for Superfreq.";
|
||||
description = "Configuration for Watt.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [cfg.package];
|
||||
|
||||
# This is necessary for the Superfreq CLI. The environment variable
|
||||
# This is necessary for the Watt CLI. The environment variable
|
||||
# passed to the systemd service will take priority in read order.
|
||||
environment.etc."superfreq.toml".source = cfgFile;
|
||||
environment.etc."watt.toml".source = cfgFile;
|
||||
|
||||
systemd.services.superfreq = {
|
||||
systemd.services.watt = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
conflicts = [
|
||||
"auto-cpufreq.service"
|
||||
|
@ -45,12 +45,12 @@ in {
|
|||
"thermald.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
Environment = optional (cfg.settings != {}) ["SUPERFREQ_CONFIG=${cfgFile}"];
|
||||
Environment = optional (cfg.settings != {}) ["WATT_CONFIG=${cfgFile}"];
|
||||
WorkingDirectory = "";
|
||||
ExecStart = "${getExe cfg.package} daemon --verbose";
|
||||
Restart = "on-failure";
|
||||
|
||||
RuntimeDirectory = "superfreq";
|
||||
RuntimeDirectory = "watt";
|
||||
RuntimeDirectoryMode = "0755";
|
||||
};
|
||||
};
|
||||
|
@ -60,14 +60,14 @@ in {
|
|||
assertion = !config.services.power-profiles-daemon.enable;
|
||||
message = ''
|
||||
You have set services.power-profiles-daemon.enable = true;
|
||||
which conflicts with Superfreq.
|
||||
which conflicts with Watt.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = !config.services.auto-cpufreq.enable;
|
||||
message = ''
|
||||
You have set services.auto-cpufreq.enable = true;
|
||||
which conflicts with Superfreq.
|
||||
which conflicts with Watt.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
fs = lib.fileset;
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "superfreq";
|
||||
pname = "watt";
|
||||
version = "0.1.0";
|
||||
|
||||
src = fs.toSource {
|
||||
|
@ -24,14 +24,14 @@ in
|
|||
meta = {
|
||||
description = "Automatic CPU speed & power optimizer for Linux";
|
||||
longDescription = ''
|
||||
Superfreq is a CPU speed & power optimizer for Linux. It uses
|
||||
Watt is a CPU speed & power optimizer for Linux. It uses
|
||||
the CPU frequency scaling driver to set the CPU frequency
|
||||
governor and the CPU power management driver to set the CPU
|
||||
power management mode.
|
||||
|
||||
'';
|
||||
homepage = "https://github.com/NotAShelf/superfreq";
|
||||
mainProgram = "superfreq";
|
||||
homepage = "https://github.com/NotAShelf/watt";
|
||||
mainProgram = "watt";
|
||||
license = lib.licenses.mpl20;
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::time::Duration;
|
|||
|
||||
/// Prints comprehensive debug information about the system
|
||||
pub fn run_debug(config: &AppConfig) -> Result<(), AppError> {
|
||||
println!("=== SUPERFREQ DEBUG INFORMATION ===");
|
||||
println!("=== WATT DEBUG INFORMATION ===");
|
||||
println!("Version: {}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
// Current date and time
|
||||
|
@ -190,11 +190,11 @@ pub fn run_debug(config: &AppConfig) -> Result<(), AppError> {
|
|||
|
||||
println!("\n--- DAEMON STATUS ---");
|
||||
// Simple check for daemon status - can be expanded later
|
||||
let daemon_status = fs::metadata("/var/run/superfreq.pid").is_ok();
|
||||
let daemon_status = fs::metadata("/var/run/watt.pid").is_ok();
|
||||
println!("Daemon Running: {daemon_status}");
|
||||
|
||||
// Check for systemd service status
|
||||
if let Ok(systemd_status) = is_systemd_service_active("superfreq") {
|
||||
if let Ok(systemd_status) = is_systemd_service_active("watt") {
|
||||
println!("Systemd Service Active: {systemd_status}");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,26 +32,26 @@ pub fn load_config_from_path(specific_path: Option<&str>) -> Result<AppConfig, C
|
|||
)));
|
||||
}
|
||||
|
||||
// Check for SUPERFREQ_CONFIG environment variable
|
||||
if let Ok(env_path) = std::env::var("SUPERFREQ_CONFIG") {
|
||||
// Check for WATT_CONFIG environment variable
|
||||
if let Ok(env_path) = std::env::var("WATT_CONFIG") {
|
||||
let env_path = Path::new(&env_path);
|
||||
if env_path.exists() {
|
||||
println!(
|
||||
"Loading config from SUPERFREQ_CONFIG: {}",
|
||||
"Loading config from WATT_CONFIG: {}",
|
||||
env_path.display()
|
||||
);
|
||||
return load_and_parse_config(env_path);
|
||||
}
|
||||
eprintln!(
|
||||
"Warning: Config file specified by SUPERFREQ_CONFIG not found: {}",
|
||||
"Warning: Config file specified by WATT_CONFIG not found: {}",
|
||||
env_path.display()
|
||||
);
|
||||
}
|
||||
|
||||
// System-wide paths
|
||||
let config_paths = vec![
|
||||
PathBuf::from("/etc/xdg/superfreq/config.toml"),
|
||||
PathBuf::from("/etc/superfreq.toml"),
|
||||
PathBuf::from("/etc/xdg/watt/config.toml"),
|
||||
PathBuf::from("/etc/watt.toml"),
|
||||
];
|
||||
|
||||
for path in config_paths {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Configuration types and structures for superfreq
|
||||
// Configuration types and structures for Watt
|
||||
use crate::core::TurboSetting;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
|
|
|
@ -152,7 +152,7 @@ fn get_available_governors() -> Result<Vec<String>> {
|
|||
// First try the traditional path with cpu0. This is the most common case
|
||||
// and will usually catch early, but we should try to keep the code to handle
|
||||
// "edge" cases lightweight, for the (albeit smaller) number of users that
|
||||
// run Superfreq on unusual systems.
|
||||
// run Watt on unusual systems.
|
||||
let cpu0_path = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors";
|
||||
if Path::new(cpu0_path).exists() {
|
||||
let content = fs::read_to_string(cpu0_path).map_err(|e| {
|
||||
|
@ -546,12 +546,12 @@ pub fn get_platform_profiles() -> Result<Vec<String>> {
|
|||
}
|
||||
|
||||
/// Path for storing the governor override state
|
||||
const GOVERNOR_OVERRIDE_PATH: &str = "/etc/xdg/superfreq/governor_override";
|
||||
const GOVERNOR_OVERRIDE_PATH: &str = "/etc/xdg/watt/governor_override";
|
||||
|
||||
/// Force a specific CPU governor or reset to automatic mode
|
||||
pub fn force_governor(mode: GovernorOverrideMode) -> Result<()> {
|
||||
// Create directory if it doesn't exist
|
||||
let dir_path = Path::new("/etc/xdg/superfreq");
|
||||
let dir_path = Path::new("/etc/xdg/watt");
|
||||
if !dir_path.exists() {
|
||||
fs::create_dir_all(dir_path).map_err(|e| {
|
||||
if e.kind() == io::ErrorKind::PermissionDenied {
|
||||
|
@ -605,7 +605,7 @@ pub fn force_governor(mode: GovernorOverrideMode) -> Result<()> {
|
|||
println!(
|
||||
"Governor override set to '{governor}'. This setting will persist across reboots."
|
||||
);
|
||||
println!("To reset, use: superfreq force-governor reset");
|
||||
println!("To reset, use: watt force-governor reset");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ pub fn run_daemon(config: AppConfig, verbose: bool) -> Result<(), AppError> {
|
|||
// Update the log level filter if needed, without re-initializing the logger
|
||||
log::set_max_level(level_filter);
|
||||
|
||||
info!("Starting superfreq daemon...");
|
||||
info!("Starting Watt daemon...");
|
||||
|
||||
// Validate critical configuration values before proceeding
|
||||
if let Err(err) = validate_poll_intervals(
|
||||
|
|
|
@ -228,7 +228,7 @@ pub fn determine_and_apply_settings(
|
|||
manage_auto_turbo(report, selected_profile_config, on_ac_power)?;
|
||||
} else {
|
||||
debug!(
|
||||
"Superfreq's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control."
|
||||
"Watt's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control."
|
||||
);
|
||||
// Make sure the system is set to its default automatic turbo mode.
|
||||
// This is important if turbo was previously forced off.
|
||||
|
|
|
@ -413,7 +413,7 @@ fn main() -> Result<(), AppError> {
|
|||
Some(Commands::Daemon { verbose }) => daemon::run_daemon(config, verbose),
|
||||
Some(Commands::Debug) => cli::debug::run_debug(&config),
|
||||
None => {
|
||||
info!("Welcome to superfreq! Use --help for commands.");
|
||||
info!("Welcome to Watt! Use --help for commands.");
|
||||
debug!("Current effective configuration: {config:?}");
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue