-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make game-performance wrapper script also consider tuned-ppd #127
Comments
Unless something has changed since v2.24.0, neither tuned nor tuned-ppd support switching on-demand per application like
ppd is a hard requirement for this script and all the script does is call |
That's fair. And no, tuned-ppd does not support switching on-demand. It is still something that would have to be done kind of manually within the script by getting the current power profile, setting the new power profile, executing the actual command and then reverting to the initial profile after the execution of the command is finished or canceled. |
But other than that, isnt all that |
I'm currently using this script which essentially does the same but with tuned-ppd: #!/usr/bin/bash
# Function to revert the profile
revert_profile() {
echo "Reverting to the previous power profile: $CURRENT_PROFILE"
tuned-adm profile "$CURRENT_PROFILE"
}
# Check if the tuned-adm command exists
if ! command -v tuned-adm &>/dev/null; then
echo "Error: tuned-adm not found" >&2
exit 1
fi
# Get the current power profile
CURRENT_PROFILE=$(tuned-adm active | awk -F': ' '{print $2}')
if [ -z "$CURRENT_PROFILE" ]; then
echo "Error: Failed to retrieve the current power profile."
exit 1
fi
echo "Current power profile: $CURRENT_PROFILE"
# Don't fail if the CPU driver doesn't support performance power profile
if ! tuned-adm list | grep -q 'throughput-performance'; then
exec "$@"
fi
# Change the power profile to throughput-performance
echo "Switching to power profile: throughput-performance"
if ! tuned-adm profile throughput-performance; then
echo "Error: Failed to switch to throughput-performance profile."
exit 1
fi
# Trap signals to revert the profile if the script is interrupted
trap revert_profile EXIT INT TERM
# Run the specified command
echo "Running command: $*"
"$@"
# Revert the profile after the command finishes
revert_profile I just thought that it could be made part of the game-performance script to have some added flexibility for people who are using tuned-ppd over power-profiles-daemon. |
Currently the script only consideres powerprofilesctl to switch power profiles. If you instead use tuned-ppd, the script actually fails without starting the game/command it is supposed to start.
So it would be nice if the script either doesn't fail and instead just runs the command without switching the power profile, or (which would be even nicer) the script automatically consideres tuned-ppd (via tuned-adm) to switch to the power profile "throughput-performance".
Background for this:
When using CachyOS-Settings with a distribution like Fedora, the script runs into a "powerprofilesctl not found" error. This is due to Fedora using tuned-ppd over power-profiles-daemon by default. So in the worst case using this wrapper script should simply have no effect in my opinion.
Is this something worth considering?
The text was updated successfully, but these errors were encountered: