nefelim4ag / Ananicy

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

Doesn't appear to be working with wine programs #126

Open HK47196 opened 6 years ago

HK47196 commented 6 years ago

It reports the "cmd" for every wine program is just wine{32,64}-preloader rather than the actual .exe

ghost commented 6 years ago

Regularly I have wine .exes - from one particular folder - get out of control, so I too would welcome it, were the wonderful ananicy able to tame such processes (or, indeed, kill them after a specified amount of time).

nefelim4ag commented 6 years ago

the problem from my point of view, what that not too easy to get wine programm name:

    "30722": {
        "pid": 30695,
        "tpid": 30722,
        "exe": "/home/nefelim4ag/.local/share/lutris/runners/wine/esync-3.15-x86_64/bin/wine64-preloader",
        "cmd": "wine64-preloader",
        "stat": "30722 (explorer.exe) S 1 30695 30695 0 -1 4194368 3 0 0 0 0 0 0 0 10 -10 4 0 7706527 1936945152 5228 18446744073709551615 4194304 2084577544 140725758193040 0 0 0 0 4096 1790 0 0 0 -1 1 0 0 0 0 0 2086678528 2086678624 2102517760 140725758195031 140725758195241 140725758195241 140725758197663 0",
        "nice": -10,
        "sched": "normal",
        "ionice": [
            "realtime",
            "4"
        ],
        "oom_score_adj": 0,
        "cmdline": [
            "C:\\windows\\system32\\explorer.exe",
            "/desktop"
        ]
    },
ghost commented 6 years ago

Is the program name, in the case you give, explorer.exe? If so, then - presuming the name always appears in the same position within that structure - you need the correct bit of grep and/or awk and/or sed (etc.) magic - or something from within Python? - to extract that field. (Actually, though, explorer.exe appears twice in the data you gave - which might make things easier.) I'm not sufficiently good at bash or python (indeed I don't know python at all) to supply the actual code you need, I am afraid.

nefelim4ag commented 6 years ago

That must work: https://github.com/Nefelim4ag/Ananicy/commit/0f7087714d5347aadc37053759301c56656cb6ac

kakra commented 6 years ago

The single wine process name should be in /proc/PID/comm. I've recently finished a PR for GameMode which resolves the complete wine path through the prefix to a unix path so we can have full-path blacklisting there. It works but is quite a hassle.

ghost commented 5 years ago

Might I ask - for this is relevant to nicing Wine programs, but also to nicing other programs - whether one can use wildcards, or specify (whole) folders, in the name field in the configuration files? Sorry if this is documented somewhere and I have overlooked that documentation.

nefelim4ag commented 5 years ago

@CottonEaster, i'm not like wildcards, what's just too costly for processing them. I.e. currently we have complexity of matching like O(n) * O(1). If i allow wildcards, each wild card must be processed for each process in the system. Or we need some tricky way to process them.

Which problem you try to solve?

ghost commented 5 years ago

Thanks. The problem is as follows.

I have a chess game, that runs on Wine, that has a folder full of different exes. Each exe is a different chess engine; which of those files exist changes as the chess program is updated. Some (perhaps all) of those engines can really hammer my CPU (because, under certain settings in the chess app, the selected engine will constantly use 10% of some single, unchanging CPU core), causing high temperatures and loud fan noise. Still, re-nicing any such process will probably not help much. I suppose what I need is a hard throttler. cpulimit is such a tool. I can't recall whether it allows wildcards or folders, though (I did try it once before) and I am having trouble finding documentation.

ghost commented 5 years ago

OK, cputool was in my repositories and it has a somewhat comprehensive manpage. The latter says it identifies processes by pid or by pid-pgrp. I hadn't heard of the latter before.