cpu usage improvements and misc

This commit is contained in:
Carl Manzi 2021-01-05 22:25:25 -05:00
parent bf1ad09490
commit 3127130b19
4 changed files with 14 additions and 64 deletions

View file

@ -1,52 +0,0 @@
$Host::AdminPassword = "changethis";
$Host::allowAdminPlayerVotes = "0";
$Host::AllowMapScript = 1;
$Host::BanTime = 1800;
$Host::BotCount = 7;
$Host::BotsEnabled = "0";
$Host::ClassicSuperAdminPassword = "changethis";
$Host::CRCTextures = 0;
$Host::FloodProtectionEnabled = 1;
$Host::GameName = "Tribes 2 Classic CTF Server";
$Host::HiVisibility = "1";
$Host::holoName1 = "Storm";
$Host::holoName2 = "Inferno";
$Host::holoName3 = "Starwolf";
$Host::holoName4 = "DSword";
$Host::holoName5 = "BloodEagle";
$Host::holoName6 = "Harbinger";
$Host::Info = "This is a Tribes 2 Classic Server.";
$Host::KickBanTime = 300;
$Host::Map = "Minotaur";
$Host::MarkDnDObjectives = 1;
$Host::MaxMessageLen = 120;
$Host::MaxPlayers = "64";
$Host::MissionType = "CTF";
$Host::NoSmurfs = 0;
$Host::PlayerRespawnTimeout = "60";
$Host::Port = "28000";
$Host::PureServer = 0;
$Host::TeamDamageOn = "1";
$Host::TeamName0 = "Unassigned";
$Host::TeamName1 = "Storm";
$Host::TeamName2 = "Inferno";
$Host::TeamName3 = "Starwolf";
$Host::TeamName4 = "Diamond Sword";
$Host::TeamName5 = "Blood Eagle";
$Host::TeamName6 = "Phoenix";
$Host::TeamSkin0 = "blank";
$Host::TeamSkin1 = "base";
$Host::TeamSkin2 = "baseb";
$Host::TeamSkin3 = "swolf";
$Host::TeamSkin4 = "dsword";
$Host::TeamSkin5 = "beagle";
$Host::TeamSkin6 = "cotp";
$Host::TimeLimit = "200";
$Host::TN::beat = 3;
$Host::TN::echo = 1;
$Host::TournamentMode = "0";
$Host::UseHighPerformanceCounter = 0;
$Host::VotePassPercent = "60";
$Host::VoteSpread = 20;
$Host::VoteTime = "30";
$Host::warmupTime = "20";

2
setup
View file

@ -1,4 +1,6 @@
#!/usr/bin/env -S python3 -B #!/usr/bin/env -S python3 -B
from tqdm import tqdm
from hashlib import md5
from os import system, unlink, symlink, makedirs, geteuid, getcwd, chmod, rename from os import system, unlink, symlink, makedirs, geteuid, getcwd, chmod, rename
from os.path import isfile, isdir from os.path import isfile, isdir
from time import time from time import time

View file

@ -79,20 +79,20 @@ def server_files(config):
mlist.write("") mlist.write("")
def runaway_control(): def runaway_control(runaway_proc_cmd):
""" """
When run in the background, wine will spawn a 'wineconsole --use-event=52' When run in the background, wine will spawn two 'wineconsole'
process that will consume all available CPU. This function finds that processes that will consume all available CPU. This function finds these
process and uses cpulimit to keep it under control. processes and uses cpulimit to keep them under control.
""" """
for x in range(20): for x in range(20):
sleep(15) sleep(15)
print("Checking for runaway wineconsole process...") print(f"Checking for runaway '{runaway_proc_cmd}' process...")
runaway_pid=run(["/usr/bin/pgrep","-f","wineconsole --use-event=52"],stdout=PIPE).stdout runaway_pid=run(["/usr/bin/pgrep","-f", runaway_proc_cmd],stdout=PIPE).stdout
if runaway_pid: if runaway_pid:
runaway_pid=str(int(runaway_pid)) runaway_pid=str(int(runaway_pid))
print(f"Limiting runaway wineconsole process: {runaway_pid}") print(f"Limiting runaway wineconsole process: {runaway_pid}")
run(["/usr/bin/cpulimit","-bp",runaway_pid,"-l2"]) run(["/usr/bin/cpulimit","-bp", runaway_pid,"-l2"])
break break
def master_heartbeat(): def master_heartbeat():
@ -178,9 +178,11 @@ if __name__ == "__main__":
heartbeat.daemon=True heartbeat.daemon=True
heartbeat.start() heartbeat.start()
# Cap the CPU of the runaway wineconsole process # Cap the CPU of the runaway wineconsole processes
wcpid_limit=Thread(target=runaway_control) wcpid1_limit=Thread(target=runaway_control, args=("wineconsole --use-event=52",))
wcpid_limit.start() wcpid1_limit.start()
wcpid2_limit=Thread(target=runaway_control, args=("wineconsole --use-event=188",))
wcpid2_limit.start()
# Open the console log file if running as service and start the Tribes 2 server # Open the console log file if running as service and start the Tribes 2 server
print(f"Starting Tribes 2 server: " + " ".join(server_command)) print(f"Starting Tribes 2 server: " + " ".join(server_command))

View file

@ -1,7 +1,5 @@
from tqdm import tqdm
from re import search from re import search
from requests import get from requests import get
from hashlib import md5
from os import walk from os import walk
from os.path import join, islink from os.path import join, islink
from shutil import chown from shutil import chown