Skip to content

Commit

Permalink
report: Add ATRACE results
Browse files Browse the repository at this point in the history
Signed-off-by: iipeace <[email protected]>
  • Loading branch information
iipeace committed Sep 26, 2024
1 parent 1ba6726 commit 7075816
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 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__ = "240925"
__revision__ = "240926"
__maintainer__ = "Peace Lee"
__email__ = "[email protected]"
__repository__ = "https://github.com/iipeace/guider"
Expand Down Expand Up @@ -19102,27 +19102,29 @@ def getTargetList(self, tlist):

for liter in tlist:
m = SysMgr.getTraceItem(liter)
if m:
d = m.groupdict()
if not m:
return threadData

# Make thread entity #
thread = d["thread"]
try:
threadData[thread]["comm"] = d["comm"]
except:
threadData[thread] = {}
threadData[thread]["comm"] = d["comm"]
d = m.groupdict()

# Make thread entity #
thread = d["thread"]
try:
threadData[thread]["comm"] = d["comm"]
except:
threadData[thread] = {}
threadData[thread]["comm"] = d["comm"]

# set tgid #
# set tgid #
try:
tgid = d["tgid"]
except:
try:
tgid = d["tgid"]
tgid = SysMgr.savedProcTree[thread]
except:
try:
tgid = SysMgr.savedProcTree[thread]
except:
continue
continue

threadData[thread]["tgid"] = tgid
threadData[thread]["tgid"] = tgid

return threadData

Expand Down Expand Up @@ -24698,6 +24700,7 @@ class LogMgr(object):
binderStat = {}
atraceStat = {}
threadData = {}
timelineData = []

def __init__(self, target="error"):
self.errFd = None
Expand Down Expand Up @@ -24897,6 +24900,13 @@ def _updateStat(statInfo, pid, diff, tm, point=None):
# update point info #
statInfo["point"].setdefault(point, dict(dflStat))
pointInfo = statInfo["point"][point]

if "DRAWTIME" in SysMgr.environList:
core = data.get("core")
LogMgr.timelineData.append(
[core, point, core, tm - diff, tm]
)

pointInfo["count"] += 1
pointInfo["usage"] += diff
pointInfo["last"] = tm
Expand Down Expand Up @@ -39936,7 +39946,7 @@ def _getDesc(s, t=0):
# {0:1} {1:1}
# {0:1} {1:1} -a

- {3:1} based on trace.dat
- {3:1} based on the specific file
# {0:1} {1:1} trace.dat

- {3:1} on a per-process basis
Expand Down Expand Up @@ -39978,6 +39988,9 @@ def _getDesc(s, t=0):
# {0:1} {1:1} -o . -q TRIM::9
# {0:1} {1:1} -o . -q TRIM:2:

- {3:1} based on the specific file with atrace logs and draw timeline
# {0:1} {1:1} trace.dat -q ATRACE, DRAWTIME

- {3:1} {2:1} to guider.out after converting all target inodes to paths from specific directory
# {0:1} {1:1} -o . -q CONVINODE
# {0:1} {1:1} -o . -q CONVINODE:/data
Expand Down Expand Up @@ -128302,6 +128315,10 @@ def printUsage(self):
# print binder usage #
self.printBinderInfo()

# print atrace info #
if LogMgr.atraceStat:
LogMgr.atraceHandler(0, 0)

# print kernel messages #
self.printConsoleInfo()

Expand Down Expand Up @@ -137208,24 +137225,9 @@ def _printEventWarning(func):

SysMgr.curLine += 1

# get items #
m = SysMgr.getTraceItem(string)
if not m:
# handle modified type of event #
m = SysMgr.getTraceItem(string)
if m:
d = m.groupdict()
comm = d["comm"]
core = str(long(d["core"]))
func = d["func"]
etc = d["etc"]
time = d["time"]

if "tracing_mark_write" in func:
m = re.match(r"^.+EVENT_(?P<event>\S+)", etc)
if m:
d = m.groupdict()

self.handleUserEvent(d["event"], time)
return

# get thread info #
Expand Down Expand Up @@ -140188,7 +140190,10 @@ def _updateBinderStat(binderStat, ctask, code):
elif func in ("tracing_mark_write", "0"):
m = re.match(r"^.+EVENT_(?P<event>\S+)", etc)
if not m:
_printEventWarning(func)
if "ATRACE" in SysMgr.environList:
LogMgr.parseAtraceData(d)
else:
_printEventWarning(func)
return time

d = m.groupdict()
Expand Down

0 comments on commit 7075816

Please sign in to comment.