Skip to content

Commit

Permalink
topdiff: Add sysinfo
Browse files Browse the repository at this point in the history
Signed-off-by: iipeace <[email protected]>
  • Loading branch information
iipeace committed Oct 9, 2024
1 parent 3c49737 commit c6db775
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions guider/guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__credits__ = "Peace Lee"
__license__ = "GPLv2"
__version__ = "3.9.8"
__revision__ = "241008"
__revision__ = "241009"
__maintainer__ = "Peace Lee"
__email__ = "[email protected]"
__repository__ = "https://github.com/iipeace/guider"
Expand Down Expand Up @@ -116951,6 +116951,7 @@ def _updateStats(target, usage):
unionSdList = {}
unionSdBootList = {}
statFileList = {}
sysinfoList = {}
sortStd = ""

# get diff type #
Expand Down Expand Up @@ -117100,7 +117101,10 @@ def _updateStats(target, usage):
sysUsage[r]["usage"] = stats
gstats["sysUsage"] = sysUsage

# define systemd list #
# get sysinfo #
sysinfoList[lfile] = gstats.get("sysinfo", {})

# get systemd list #
sdUnitList = gstats.get("systemdInfo", {})

# get total CPU info #
Expand Down Expand Up @@ -117612,6 +117616,30 @@ def _getFileMenu(printBuf, menuBuf, menuStat, lenStat):
)
return printBuf, menuBuf

# ----------------------------- SYSINFO ---------------------------- #
_printer(
"\n[Diff Attr Info] (NrFile: %s)\n%s"
% (convNum(len(validFlist)), twoLine)
)

jsonData["sysinfo"] = {}
nrPrint = 0
for fname in validFlist:
sysinfo = sysinfoList.get(fname)
if not sysinfo:
continue

_printer("[ %s ]" % convColor(fname, "YELLOW"))
for attr, val in sysinfo.items():
_printer("%12s: %s" % (attr, val))
_printer(oneLine)

nrPrint += 1
jsonData["sysinfo"][fname] = sysinfo

if nrPrint == 0:
_printer(" None\n%s" % oneLine)

# -------------------- SYS/CPU/DLY/PRI/GPU/LIFE -------------------- #

emptyCpuStat = "%7s(%2s)(%5s/%7s/%5s/%6s) |" % (
Expand Down Expand Up @@ -117774,7 +117802,10 @@ def _getFileMenu(printBuf, menuBuf, menuStat, lenStat):
if res in ("pri"):
totalStr = "-"
elif res == "sys" and not (
pname.startswith("net") or pname.startswith("reclaim")
pname == "cpuUsage"
or pname.startswith("net")
or pname.startswith("reclaim")
or pname.startswith("blk")
):
totalStr = "-"
else:
Expand Down Expand Up @@ -117937,11 +117968,11 @@ def _getFileMenu(printBuf, menuBuf, menuStat, lenStat):
diff = "/%7s" % diff
diffStr += diff

total = convNum(blkProcStat["total"])
total = blkProcStat["total"]

jsonData["blk"][pname][fname] = {
"diff": diffStr,
"total": total,
"total": convNum(total),
"cnt": blkProcStat["cnt"],
"min": blkProcStat["minimum"],
"avg": blkProcStat["average"],
Expand Down

0 comments on commit c6db775

Please sign in to comment.