1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-08-02 20:07:47 +00:00

Compare commits

..

No commits in common. "84154fe6d4469172fdcb2fe339e1eab9087f3543" and "841ea830c6c2f29512de45efea4fcd021e2ee792" have entirely different histories.

8 changed files with 81 additions and 80 deletions

View file

@ -30,11 +30,11 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
name: watt-linux-amd64 name: superfreq-linux-amd64
cross: false cross: false
- os: ubuntu-latest - os: ubuntu-latest
target: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu
name: watt-linux-arm64 name: superfreq-linux-arm64
cross: true cross: true
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -88,15 +88,16 @@ jobs:
uses: robinraju/release-downloader@v1 uses: robinraju/release-downloader@v1
with: with:
tag: ${{ github.ref_name }} tag: ${{ github.ref_name }}
fileName: "watt-*" fileName: "superfreq-*"
out-file-path: "." out-file-path: "."
- name: Generate checksums - name: Generate checksums
run: | run: |
sha256sum watt-* > SHA256SUMS sha256sum superfreq-* > SHA256SUMS
- name: Upload Checksums - name: Upload Checksums
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: SHA256SUMS files: SHA256SUMS

View file

@ -1,5 +1,5 @@
<h1 id="header" align="center"> <h1 id="header" align="center">
Watt Superfreq
</h1> </h1>
<div align="center"> <div align="center">
@ -8,17 +8,17 @@
<div align="center"> <div align="center">
<br/> <br/>
<a href="#what-is-watt">Synopsis</a><br/> <a href="#what-is-superfreq">Synopsis</a><br/>
<a href="#features">Features</a> | <a href="#usage">Usage</a><br/> <a href="#features">Features</a> | <a href="#usage">Usage</a><br/>
<a href="#contributing">Contributing</a> <a href="#contributing">Contributing</a>
<br/> <br/>
</div> </div>
## What is Watt ## What is Superfreq
Watt is a modern CPU frequency and power management utility for Linux systems. Superfreq is a modern CPU frequency and power management utility for Linux
It provides intelligent control of CPU governors, frequencies, and power-saving systems. It provides intelligent control of CPU governors, frequencies, and
features, helping optimize both performance and battery life. power-saving features, helping optimize both performance and battery life.
It is greatly inspired by auto-cpufreq, but rewritten from ground up to provide It is greatly inspired by auto-cpufreq, but rewritten from ground up to provide
a smoother experience with a more efficient and more correct codebase. Some a smoother experience with a more efficient and more correct codebase. Some
@ -48,81 +48,81 @@ but most common usecases are already implemented.
```bash ```bash
# Show current system information # Show current system information
watt info superfreq info
# Run as a daemon in the background # Run as a daemon in the background
sudo watt daemon sudo superfreq daemon
# Run with verbose logging # Run with verbose logging
sudo watt daemon --verbose sudo superfreq daemon --verbose
# Display comprehensive debug information # Display comprehensive debug information
watt debug superfreq debug
``` ```
### CPU Governor Control ### CPU Governor Control
```bash ```bash
# Set CPU governor for all cores # Set CPU governor for all cores
sudo watt set-governor performance sudo superfreq set-governor performance
# Set CPU governor for a specific core # Set CPU governor for a specific core
sudo watt set-governor powersave --core-id 0 sudo superfreq set-governor powersave --core-id 0
# Force a specific governor mode persistently # Force a specific governor mode persistently
sudo watt force-governor performance sudo superfreq force-governor performance
``` ```
### Turbo Boost Management ### Turbo Boost Management
```bash ```bash
# Always enable turbo boost # Always enable turbo boost
sudo watt set-turbo always sudo superfreq set-turbo always
# Disable turbo boost # Disable turbo boost
sudo watt set-turbo never sudo superfreq set-turbo never
# Let Watt manage turbo boost based on conditions # Let Superfreq manage turbo boost based on conditions
sudo watt set-turbo auto sudo superfreq set-turbo auto
``` ```
### Power and Performance Settings ### Power and Performance Settings
```bash ```bash
# Set Energy Performance Preference (EPP) # Set Energy Performance Preference (EPP)
sudo watt set-epp performance sudo superfreq set-epp performance
# Set Energy Performance Bias (EPB) # Set Energy Performance Bias (EPB)
sudo watt set-epb 4 sudo superfreq set-epb 4
# Set ACPI platform profile # Set ACPI platform profile
sudo watt set-platform-profile balanced sudo superfreq set-platform-profile balanced
``` ```
### Frequency Control ### Frequency Control
```bash ```bash
# Set minimum CPU frequency (in MHz) # Set minimum CPU frequency (in MHz)
sudo watt set-min-freq 800 sudo superfreq set-min-freq 800
# Set maximum CPU frequency (in MHz) # Set maximum CPU frequency (in MHz)
sudo watt set-max-freq 3000 sudo superfreq set-max-freq 3000
# Set per-core frequency limits # Set per-core frequency limits
sudo watt set-min-freq 1200 --core-id 0 sudo superfreq set-min-freq 1200 --core-id 0
sudo watt set-max-freq 2800 --core-id 1 sudo superfreq set-max-freq 2800 --core-id 1
``` ```
### Battery Management ### Battery Management
```bash ```bash
# Set battery charging thresholds to extend battery lifespan # Set battery charging thresholds to extend battery lifespan
sudo watt set-battery-thresholds 40 80 # Start charging at 40%, stop at 80% sudo superfreq set-battery-thresholds 40 80 # Start charging at 40%, stop at 80%
``` ```
Battery charging thresholds help extend battery longevity by preventing constant Battery charging thresholds help extend battery longevity by preventing constant
charging to 100%. Different laptop vendors implement this feature differently, charging to 100%. Different laptop vendors implement this feature differently,
but Watt attempts to support multiple vendor implementations including: but Superfreq attempts to support multiple vendor implementations including:
- Lenovo ThinkPad/IdeaPad (Standard implementation) - Lenovo ThinkPad/IdeaPad (Standard implementation)
- ASUS laptops - ASUS laptops
@ -135,12 +135,12 @@ more than issue reports, as supporting hardware _needs_ hardware.
## Configuration ## Configuration
Watt uses TOML configuration files. Default locations: Superfreq uses TOML configuration files. Default locations:
- `/etc/xdg/watt/config.toml` - `/etc/xdg/superfreq/config.toml`
- `/etc/watt.toml` - `/etc/superfreq.toml`
You can also specify a custom path by setting the `WATT_CONFIG` environment You can also specify a custom path by setting the `SUPERFREQ_CONFIG` environment
variable. variable.
### Sample Configuration ### Sample Configuration
@ -214,7 +214,7 @@ throttle_on_battery = true
# Logging level: Error, Warning, Info, Debug # Logging level: Error, Warning, Info, Debug
log_level = "Info" log_level = "Info"
# Optional stats file path # Optional stats file path
stats_file_path = "/var/run/watt-stats" stats_file_path = "/var/run/superfreq-stats"
# Optional: List of power supplies to ignore # Optional: List of power supplies to ignore
[power_supply_ignore_list] [power_supply_ignore_list]
@ -224,14 +224,14 @@ mouse_battery = "hid-12:34:56:78:90:ab-battery"
## Advanced Features ## Advanced Features
Those are the more advanced features of Watt that some users might be more Those are the more advanced features of Superfreq that some users might be more
inclined to use than others. If you have a use-case that is not covered, please inclined to use than others. If you have a use-case that is not covered, please
create an issue. create an issue.
### Dynamic Turbo Boost Management ### Dynamic Turbo Boost Management
When using `turbo = "auto"` with `enable_auto_turbo = true`, Watt dynamically When using `turbo = "auto"` with `enable_auto_turbo = true`, Superfreq
controls CPU turbo boost based on: dynamically controls CPU turbo boost based on:
- **CPU Load Thresholds**: Enables turbo when load exceeds `load_threshold_high` - **CPU Load Thresholds**: Enables turbo when load exceeds `load_threshold_high`
(default 70%), disables when below `load_threshold_low` (default 30%) (default 70%), disables when below `load_threshold_low` (default 30%)
@ -257,20 +257,20 @@ The table below explains how different combinations of `turbo` and
`enable_auto_turbo` settings affect CPU turbo behavior: `enable_auto_turbo` settings affect CPU turbo behavior:
| Setting | `enable_auto_turbo = true` | `enable_auto_turbo = false` | | Setting | `enable_auto_turbo = true` | `enable_auto_turbo = false` |
| ------------------ | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | ------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `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 = "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 = "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>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 | | `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 |
> [!NOTE] > [!NOTE]
> When `turbo = "auto"` and `enable_auto_turbo = false`, Watt ensures that any > When `turbo = "auto"` and `enable_auto_turbo = false`, Superfreq ensures that
> previous turbo state restrictions are removed, allowing the hardware/kernel to > any previous turbo state restrictions are removed, allowing the
> manage turbo behavior according to its default algorithms. > hardware/kernel to manage turbo behavior according to its default algorithms.
### Adaptive Polling ### Adaptive Polling
Watt includes a "sophisticated" (euphemism for complicated) adaptive polling Superfreq includes a "sophisticated" (euphemism for complicated) adaptive
system to try and maximize power efficiency polling system to try and maximize power efficiency
- **Battery Discharge Analysis** - Automatically adjusts polling frequency based - **Battery Discharge Analysis** - Automatically adjusts polling frequency based
on the battery discharge rate, reducing system activity when battery is on the battery discharge rate, reducing system activity when battery is
@ -294,8 +294,8 @@ idle periods, while maintaining responsiveness when needed.
### Power Supply Filtering ### Power Supply Filtering
Configure Watt to ignore certain power supplies (like peripheral batteries) that Configure Superfreq to ignore certain power supplies (like peripheral batteries)
might interfere with power state detection. that might interfere with power state detection.
## Troubleshooting ## Troubleshooting
@ -319,11 +319,11 @@ Not all features are available on all hardware:
2. **CPU frequencies fluctuating**: May be due to thermal throttling 2. **CPU frequencies fluctuating**: May be due to thermal throttling
3. **Missing CPU information**: Verify kernel module support for your CPU 3. **Missing CPU information**: Verify kernel module support for your CPU
While reporting issues, please attach the results from `watt debug`. While reporting issues, please attach the results from `superfreq debug`.
## Contributing ## Contributing
Contributions to Watt are always welcome! Whether it's bug reports, feature Contributions to Superfreq are always welcome! Whether it's bug reports, feature
requests, or code contributions, please feel free to contribute. requests, or code contributions, please feel free to contribute.
> [!NOTE] > [!NOTE]
@ -357,5 +357,5 @@ before committing to catch possible code smell early.
## License ## License
Watt is available under [Mozilla Public License v2.0](LICENSE) for your Superfreq is available under [Mozilla Public License v2.0](LICENSE) for your
convenience, and at our expense. Please see the license file for more details. convenience, and at our expense. Please see the license file for more details.

View file

@ -14,16 +14,16 @@
}); });
in { in {
overlays = { overlays = {
watt = final: _: { superfreq = final: _: {
watt = final.callPackage ./nix/package.nix {}; superfreq = final.callPackage ./nix/package.nix {};
}; };
default = self.overlays.watt; default = self.overlays.superfreq;
}; };
packages = packages =
nixpkgs.lib.mapAttrs (system: pkgs: { nixpkgs.lib.mapAttrs (system: pkgs: {
inherit (pkgs) watt; inherit (pkgs) superfreq;
default = self.packages.${system}.watt; default = self.packages.${system}.superfreq;
}) })
pkgsForEach; pkgsForEach;
@ -34,8 +34,8 @@
pkgsForEach; pkgsForEach;
nixosModules = { nixosModules = {
watt = import ./nix/module.nix inputs; superfreq = import ./nix/module.nix inputs;
default = self.nixosModules.watt; default = self.nixosModules.superfreq;
}; };
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);

View file

@ -10,32 +10,32 @@ inputs: {
inherit (lib.lists) optional; inherit (lib.lists) optional;
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
cfg = config.services.watt; cfg = config.services.superfreq;
format = pkgs.formats.toml {}; format = pkgs.formats.toml {};
cfgFile = format.generate "watt-config.toml" cfg.settings; cfgFile = format.generate "superfreq-config.toml" cfg.settings;
in { in {
options.services.watt = { options.services.superfreq = {
enable = mkEnableOption "Automatic CPU speed & power optimizer for Linux"; enable = mkEnableOption "Automatic CPU speed & power optimizer for Linux";
package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "watt" { package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "superfreq" {
pkgsText = "self.packages.\${pkgs.stdenv.system}"; pkgsText = "self.packages.\${pkgs.stdenv.system}";
}; };
settings = mkOption { settings = mkOption {
default = {}; default = {};
type = submodule {freeformType = format.type;}; type = submodule {freeformType = format.type;};
description = "Configuration for Watt."; description = "Configuration for Superfreq.";
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [cfg.package]; environment.systemPackages = [cfg.package];
# This is necessary for the Watt CLI. The environment variable # This is necessary for the Superfreq CLI. The environment variable
# passed to the systemd service will take priority in read order. # passed to the systemd service will take priority in read order.
environment.etc."watt.toml".source = cfgFile; environment.etc."superfreq.toml".source = cfgFile;
systemd.services.watt = { systemd.services.superfreq = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
conflicts = [ conflicts = [
"auto-cpufreq.service" "auto-cpufreq.service"
@ -45,12 +45,12 @@ in {
"thermald.service" "thermald.service"
]; ];
serviceConfig = { serviceConfig = {
Environment = optional (cfg.settings != {}) ["WATT_CONFIG=${cfgFile}"]; Environment = optional (cfg.settings != {}) ["SUPERFREQ_CONFIG=${cfgFile}"];
WorkingDirectory = ""; WorkingDirectory = "";
ExecStart = "${getExe cfg.package} daemon --verbose"; ExecStart = "${getExe cfg.package} daemon --verbose";
Restart = "on-failure"; Restart = "on-failure";
RuntimeDirectory = "watt"; RuntimeDirectory = "superfreq";
RuntimeDirectoryMode = "0755"; RuntimeDirectoryMode = "0755";
}; };
}; };
@ -60,14 +60,14 @@ in {
assertion = !config.services.power-profiles-daemon.enable; assertion = !config.services.power-profiles-daemon.enable;
message = '' message = ''
You have set services.power-profiles-daemon.enable = true; You have set services.power-profiles-daemon.enable = true;
which conflicts with Watt. which conflicts with Superfreq.
''; '';
} }
{ {
assertion = !config.services.auto-cpufreq.enable; assertion = !config.services.auto-cpufreq.enable;
message = '' message = ''
You have set services.auto-cpufreq.enable = true; You have set services.auto-cpufreq.enable = true;
which conflicts with Watt. which conflicts with Superfreq.
''; '';
} }
]; ];

View file

@ -5,7 +5,7 @@
fs = lib.fileset; fs = lib.fileset;
in in
rustPlatform.buildRustPackage (finalAttrs: { rustPlatform.buildRustPackage (finalAttrs: {
pname = "watt"; pname = "superfreq";
version = "0.1.0"; version = "0.1.0";
src = fs.toSource { src = fs.toSource {
@ -24,14 +24,14 @@ in
meta = { meta = {
description = "Automatic CPU speed & power optimizer for Linux"; description = "Automatic CPU speed & power optimizer for Linux";
longDescription = '' longDescription = ''
Watt is a CPU speed & power optimizer for Linux. It uses Superfreq is a CPU speed & power optimizer for Linux. It uses
the CPU frequency scaling driver to set the CPU frequency the CPU frequency scaling driver to set the CPU frequency
governor and the CPU power management driver to set the CPU governor and the CPU power management driver to set the CPU
power management mode. power management mode.
''; '';
homepage = "https://github.com/NotAShelf/watt"; homepage = "https://github.com/NotAShelf/superfreq";
mainProgram = "watt"; mainProgram = "superfreq";
license = lib.licenses.mpl20; license = lib.licenses.mpl20;
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };

View file

@ -441,7 +441,7 @@ impl Cpu {
if !epps.iter().any(|avail_epp| avail_epp == epp) { if !epps.iter().any(|avail_epp| avail_epp == epp) {
bail!( bail!(
"EPP value '{epp}' is not available for {self}. available EPP values: {epps}", "EPP value '{epp}' is not availabile for {self}. available EPP values: {epps}",
epps = epps.join(", "), epps = epps.join(", "),
); );
} }

View file

@ -110,7 +110,7 @@ struct CpuLog {
/// CPU usage between 0-1, a percentage. /// CPU usage between 0-1, a percentage.
usage: f64, usage: f64,
/// CPU temperature in celsius. /// CPU temperature in celcius.
temperature: f64, temperature: f64,
} }
@ -261,7 +261,7 @@ impl Daemon {
} }
} }
// If we can't determine the discharge rate, that means that // If we can't deterine the discharge rate, that means that
// we were very recently started. Which is user activity. // we were very recently started. Which is user activity.
None => { None => {
interval *= 2; interval *= 2;

View file

@ -204,7 +204,7 @@ pub fn determine_and_apply_settings(
manage_auto_turbo(report, selected_profile_config, on_ac_power)?; manage_auto_turbo(report, selected_profile_config, on_ac_power)?;
} else { } else {
log::debug!( log::debug!(
"Watt's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control." "Superfreq'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. // Make sure the system is set to its default automatic turbo mode.
// This is important if turbo was previously forced off. // This is important if turbo was previously forced off.