Browse Source

Timings - Xmx = Xms

master
DrBot7 4 years ago
committed by GitHub
parent
commit
c8cae08b2d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      cogs/timings.py

48
cogs/timings.py

@ -117,32 +117,40 @@ class Timings(commands.Cog):
embed_var.add_field(name="⚠ Outdated Flags", embed_var.add_field(name="⚠ Outdated Flags",
value="Add `-XX:G1MixedGCCountTarget=4` to flags", value="Add `-XX:G1MixedGCCountTarget=4` to flags",
inline=True) inline=True)
if "-Xmx" in flags:
max_mem = 0
flaglist = flags.split(" ")
for flag in flaglist:
if flag.startswith("-Xmx"):
max_mem = flag.split("-Xmx")[1]
max_mem = max_mem.replace("G", "000")
max_mem = max_mem.replace("M", "")
max_mem = max_mem.replace("g", "000")
max_mem = max_mem.replace("m", "")
if int(max_mem) < 5400:
embed_var.add_field(name="⚠ Low Memory",
value="Allocate at least 6-10GB of ram to your server if you can afford it.",
inline=True)
if "-Xms" in flags:
min_mem = 0
flaglist = flags.split(" ")
for flag in flaglist:
if flag.startswith("-Xmx"):
min_mem = flag.split("-Xmx")[1]
min_mem = min_mem.replace("G", "000")
min_mem = min_mem.replace("M", "")
min_mem = min_mem.replace("g", "000")
min_mem = min_mem.replace("m", "")
if min_mem != max_mem:
embed_var.add_field(name="⚠ Aikar's Flags",
value="Your Xmx and Xms values must be equal with Aikar's flags.",
inline=True)
else: else:
embed_var.add_field(name="⚠ Aikar's Flags", embed_var.add_field(name="⚠ Aikar's Flags",
value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).",
inline=True) inline=True)
except KeyError: except KeyError:
unchecked = unchecked + 1 unchecked = unchecked + 1
try:
flags = r["timingsMaster"]["system"]["flags"]
if "-Xmx" in flags:
max_mem = 0
flaglist = flags.split(" ")
for flag in flaglist:
if flag.startswith("-Xmx"):
max_mem = flag.split("-Xmx")[1]
max_mem = max_mem.replace("G", "000")
max_mem = max_mem.replace("M", "")
max_mem = max_mem.replace("g", "000")
max_mem = max_mem.replace("m", "")
if int(max_mem) < 5400:
embed_var.add_field(name="⚠ Low Memory",
value="Allocate at least 6-10GB of ram to your server if you can afford it.",
inline=True)
except KeyError:
unchecked = unchecked + 1
try: try:
cpu = int(r["timingsMaster"]["system"]["cpu"]) cpu = int(r["timingsMaster"]["system"]["cpu"])
if cpu <= 2: if cpu <= 2:

Loading…
Cancel
Save