DOKK / manpages / debian 10 / gamemode / gamemoded.8.en
gamemoded(8) gamemoded man page gamemoded(8)

gamemoded - optimises system performance on demand

gamemoded [-d] [-l] [-h] [-v]

GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

The design has a clear cut abstraction between the host daemon and library (gamemoded and libgamemode), and the client loaders (libgamemodeauto and gamemode_client.h) that allows for safe usage without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on systemd for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients.

GameMode was designed primarily as a stop-gap solution to problems with the Intel and AMD CPU powersave or ondemand governors, but is intended to be expanded beyond just CPU governor states, as there are a wealth of automation tasks one might want to apply.

Run the daemon as a separate process (daemonize it)
Log to syslog
Request gamemode and wait for any signal
Query the current status of gamemode
Print help text
Print the version

libgamemodeauto.so.0 can be pre-loaded into any program to request gamemoded begin or end the mode, like so:

LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 ./game

Or by setting the steam launch options for a game:

LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 %command%

The gamemode_client.h header can be used by developers to build the requests into a program:

#include "gamemode_client.h"

if( gamemode_request_start() < 0 ) {
fprintf( stderr, "gamemode request failed: %s\n", gamemode_error_string() )
}
/* run the process */
/* Not required, gamemoded can clean up after game exits */
gamemode_request_end();

Atlernatively developers can define GAMEMODE_AUTO to mimic the behaviour of libgamemodeauto.so.0:

#define GAMEMODE_AUTO
#include "gamemode_client.h"

Or, distribute libgamemodeauto.so.0 and either link with -lgamemodeauto or inject it as above with LD_PRELOAD.

gamemoded will load and merge gamemode.ini config files from these directories in the following order:

/usr/share/gamemode/
/etc/
$XDG_CONFIG_HOME or $HOME/.config/
$PWD

Behaviour of the config file can be explained by presenting a commented example:

[general]
; The reaper thread will check every 10 seconds for exited clients
reaper_freq=10
; The desired governor is used when entering GameMode instead of "performance"
desiredgov=performance
; The default governer is used when leaving GameMode instead of restoring the original value
defaultgov=powersave
; By default, GameMode changes the scheduler policy to SCHED_ISO with 4 or more CPU cores,
; force enable or disable with "on" or "off"
softrealtime=auto
; By default, GameMode renices the client to -4, you can put any value between 1 and 20 here,
; the value will be negated and applied as a nice value
renice = 4
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist
;whitelist=RiseOfTheTombRaider
; Gamemode will always reject anything in the blacklist
blacklist=HalfLife3

glxgears [custom] ; Custom scripts (executed using the shell) when gamemode starts and ends start=notify-send "GameMode started"
/home/me/bin/stop_ethmining.sh end=notify-send "GameMode ended"
/home/me/bin/start_ethmining.sh

This config file will currently reject any games that match HalfLife3 or glxgears, but can be modified to only accept RiseOfTheTombRaider by removing the semicolon preceding the fourth line.

systemd(1)

GameMode source can be found at https://github.com/FeralInteractive/gamemode.git

Feral Interactive (linux-contact@feralinteractive.com)

21 July 2018 1.2