Removing CPU time

pull/8/head
sgoudham 4 years ago
parent ad157ed7e1
commit 80d6ca22ab

@ -214,29 +214,21 @@ class Info(commands.Cog):
proc = Process()
with proc.oneshot():
uptime = datetime.timedelta(seconds=time() - proc.create_time())
cpu = proc.cpu_times()
if cpu:
cpu_time = datetime.timedelta(seconds=cpu.system + cpu.user)
mem_total = virtual_memory().total / (1024 ** 2)
mem_of_total = proc.memory_percent()
mem_usage = mem_total * (mem_of_total / 100)
cpu_hours, cpu_remainder = divmod(cpu_time.seconds, 3600)
cpu_minutes, cpu_seconds = divmod(cpu_remainder, 60)
uptime_hours, uptime_remainder = divmod(uptime.seconds, 3600)
uptime_minutes, uptime_seconds = divmod(uptime_remainder, 60)
frmt_uptime = '{:01} Hours, {:01} Minutes, {:01} Seconds'.format(int(uptime_hours), int(uptime_minutes),
int(uptime_seconds))
frmt_cputime = '{:01} Hours, {:01} Minutes, {:01} Seconds'.format(int(cpu_hours), int(cpu_minutes),
int(cpu_seconds))
# Setting up fields
fields = [
("Developer", "Hamothy#5619", True),
("Bot Version", "1.7.2", False),
("Language | Library", f"Python {python_version()} | Discord.py {discord_version}", False),
("Uptime", frmt_uptime, True),
("CPU Time", frmt_cputime, True),
("Uptime", frmt_uptime, False),
("Memory Usage", f"{mem_usage:,.2f} / {mem_total:,.2f} MiB ({mem_of_total:.2f}%)", False),
("Guilds", f"{len(self.bot.guilds)}", True),
("Users", f"{len(self.bot.users):,}", True)

Loading…
Cancel
Save