Skip to content

Commit

Permalink
topsum: Add PSI parser
Browse files Browse the repository at this point in the history
Signed-off-by: iipeace <[email protected]>
  • Loading branch information
iipeace committed Sep 9, 2024
1 parent 7be437b commit 908eb80
Showing 1 changed file with 69 additions and 20 deletions.
89 changes: 69 additions & 20 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__ = "240908"
__revision__ = "240909"
__maintainer__ = "Peace Lee"
__email__ = "[email protected]"
__repository__ = "https://github.com/iipeace/guider"
Expand Down Expand Up @@ -115237,6 +115237,7 @@ class TaskAnalyzer(object):
procEventData = []
procTreeData = {}
procPrioData = {}
procTempData = {}
dbusData = {"totalCnt": 0, "totalErr": 0}
dbgObj = None
tmpObj = None
Expand Down Expand Up @@ -120660,38 +120661,40 @@ def drawYticks(
else:
yticks(fontsize=fontsize)
else:
if ymax is None:
ylist = ax.get_yticks().tolist()
ymax = long(max(ylist))
# get real ymin and ymax #
rymin = SysMgr.maxSize
rymax = -(SysMgr.maxSize)
for l in ax.get_lines():
yvals = l.get_data()[1]
rymin = min(rymin, min(yvals))
rymax = max(rymax, max(yvals))

# update stats #
if ymax is None and rymax != -(SysMgr.maxSize):
ymax = long(rymax)
if rymin != SysMgr.maxSize:
ymin = rymin

# update max #
if margin:
ymaxval = ymax + int(ymax / unit)
else:
ymaxval = ymax

if ymaxval > 0:
ylim([0, ymaxval])

# check ymin #
# update min #
if not negYmin:
if ymin < 0:
ylist = ax.get_yticks().tolist()
ymin = long(min(ylist))
else:
yminval = ymin - int(ymin / unit)
ax.set_ylim(bottom=yminval)

# adjust ymin #
if ymin < 0:
ymin = 0
ax.set_ylim(bottom=0)
yminval = ymin - int(ymin / unit)
ymin = 0 if yminval < 0 else yminval
ax.set_ylim(bottom=ymin)

# adjust yticks #
if adjust:
ymin = long(ymin)
ymax = long(ymax)

inc = long(ymax / unit)
inc = long((ymax - ymin) / unit)
if inc == 0:
inc = 1

Expand Down Expand Up @@ -122149,7 +122152,12 @@ def _getYrange(ax):
return yrange[0], yrange[-1]

def _drawStack(
timeline, stackedStats, stackedTexts, self, ax, acc=True
timeline,
stackedStats,
stackedTexts,
self,
ax,
acc=True,
):
if not stackedStats:
return
Expand Down Expand Up @@ -122237,6 +122245,19 @@ def _drawStack(
fontweight="normal",
)

# draw last text #
tobj = text(
timeline[-1],
ypos,
stackedTexts[i].split()[-1],
fontsize=(
fontsize if fontsize < self.lfsize else self.lfsize
)
/ 2,
fontweight="normal",
ha="right",
)

def _drawEvent(graphStats, logEvents):
# get minimum timeline #
timeline = None
Expand Down Expand Up @@ -124477,7 +124498,7 @@ def __drawMemPlots(ymax, stacked=False):

__drawSysMem = lambda a, b, c, d: (
convSize(a[-1] << 20) if a else None,
max(a) + c,
max(max(a), c),
)
else:
__drawSysMem = __drawSystemMem
Expand Down Expand Up @@ -131309,6 +131330,13 @@ def parseProcLine(index, procLine):
except:
procIntData["total"]["blkwait"] = 0

# save temporary data on this interval #
try:
procIntData["total"].update(TA.procTempData)
TA.procTempData = {}
except:
pass

# parse MEM stat #
m = re.match(
(
Expand Down Expand Up @@ -131383,6 +131411,27 @@ def parseProcLine(index, procLine):

return

# PSI #
elif len(tokens) == 1 and tokens[0].startswith(" "):
# parse PSI stat #
m = re.match(
(
r"\s*\[PSI > \[cpu\] some\((?P<cpu_some>\d+(\.\d+)?)%\)"
r"( / full\((?P<cpu_full>\d+\.\d+)%\))?"
r"\s*\[memory\] some\((?P<mem_some>\d+(\.\d+)?)%\)"
r" / full\((?P<mem_full>\d+(\.\d+)?)%\)"
r"\s*\[io\] some\((?P<io_some>\d+(\.\d+)?)%\)"
r" / full\((?P<io_full>\d+(\.\d+)?)%\)\]"
),
tokens[0],
)
if m:
d = m.groupdict()

psiStats = {k: float(v) if v else 0 for k, v in d.items()}

TA.procTempData["psi"] = psiStats

# GPU #
elif len(tokens) == 5:
m = re.match(
Expand Down

0 comments on commit 908eb80

Please sign in to comment.