nefelim4ag / Ananicy

Ananicy - is Another auto nice daemon, with community rules support (Use pull request please)
GNU General Public License v3.0
567 stars 79 forks source link

Steam games are not being reniced #452

Open CygnusTerminal opened 2 years ago

CygnusTerminal commented 2 years ago

Hello, my steam games are not being reniced. It seems that ananicy reads the rules, but is unable to renice the process. Trying to run ananicy from the console shows various processes being reniced, except steam games (wineserver shows as being reniced to 19, but it's still kept at 1). Renicing manually works fine.

machinedgod commented 1 year ago

Had the some problem, but figured out why and how to fix it.

First, find your game's PID (ps, htop, pgrep), then run ananicy dump proc | grep -A 10 '(<pid>' to see internal process map the way Ananicy sees it (it uses the /proc tree). You should see the output similar to this:

 (255763, 255841, 'wine64-preloader'): {'autogroup': {'group': 945, 'nice': 0},
                                        'cmd': 'wine64-preloader',
                                        'cmdline': ('Z:\\home\\john\\.local\\share\\Steam\\steamapps\\common\\Get '
                                                    'To The Orange Door\\Get '
                                                    'To The Orange Door.exe',
                                                    '',
                                                    '',
                                                    '',

Notice that cmd is not the game's exe name, but wine64-preloader. The game's name (with its full path) is the parameter - don't get confused with parameter being split multiple lines, notice that first two do not have comma at the end - so they'll be concatenated together.

Now, if you write a rule such as:

{ "name": "wine64-preloader", "type": "game"}

this'll apply the rule to all wine processes - which is not what you want.

You need to use cmdlines parameter (as explained in documentation) and add the game's full path as a parameter. This is the rule I've created for "Get To The Orange Door" and it works.

# https://store.steampowered.com/app/541200/GTTOD_Get_To_The_Orange_Door/
{ "name": "wine64-preloader", "cmdlines": ["Z:\\home\\john\\.local\\share\\Steam\\steamapps\\common\\Get To The Orange Door\\Get To The Orange Door.exe"], "type": "game"}

Now, the question that I can't answer - is /this/ the process that needs to have its niceness upped, since its a wine process? Does wine need upping priority too? Can't anwer these, but GTTOD used to drop to 43FPS for me and have few stutters when loading - niceing it to -20 fixed all of that, and now it runs at stable >60FPS..

Fun fact: I've checked about 50-60% of wine rules in the 00-defaults - and they're all wrongly set up, ie. neither one will work.

Scratch that - Fallout76.exe works by default config, and the dump proc output returns same value as for GTTOD. I wonder if spaces in the title make a difference...