import subprocess
import os
import re
+from datetime import timedelta
+from multiprocessing import cpu_count
from logparse.formatting import *
from logparse.config import prefs
else:
logger.warning("Failed to find processor data")
+ raw_uptime = util.readlog(prefs.get("logs", "uptime")).split("\n")[0]
+ logger.debug("Found uptime data " + str(raw_uptime))
+
+ uptime_total = float(raw_uptime.split()[0])
+ table.add_row(Row([Column("Uptime"), Column("%d d %d h %d m" % (uptime_total // 86400, uptime_total % 86400 // 3600, uptime_total % 3600 // 60))]))
+
+ idle_time = float(raw_uptime.split()[1]) / cpu_count()
+ m, s = divmod(idle_time, 60)
+ h, m = divmod(m, 60)
+ table.add_row(Row([Column("Idle time"), Column("%d d %d h %d m per core (avg)" % (idle_time // 86400, idle_time % 86400 // 3600, idle_time % 3600 // 60))]))
+
logger.info("Finished sysinfo section")
return section