-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: iipeace <[email protected]>
- Loading branch information
Showing
1 changed file
with
90 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
__credits__ = "Peace Lee" | ||
__license__ = "GPLv2" | ||
__version__ = "3.9.8" | ||
__revision__ = "240926" | ||
__revision__ = "240927" | ||
__maintainer__ = "Peace Lee" | ||
__email__ = "[email protected]" | ||
__repository__ = "https://github.com/iipeace/guider" | ||
|
@@ -12011,7 +12011,7 @@ def _draw_segments(self, dwg, start=0): | |
start = float(start) / self.time_factor | ||
|
||
for idx, segment in enumerate( | ||
sorted(self.segments, key=lambda e: len(e.state)) | ||
sorted(self.segments, key=lambda e: (e.time_start, len(e.state))) | ||
): | ||
UtilMgr.printProgress(idx, len(self.segments)) | ||
self._draw_segment(segment, dwg, start) | ||
|
@@ -12197,7 +12197,7 @@ def _draw_segment(self, segment, dwg, start=0): | |
) | ||
) | ||
# draw line for syscall status # | ||
elif segment.state == "SYSCALL": | ||
elif segment.state in ("SYSCALL", "ATRACE"): | ||
g.add( | ||
dwg.rect( | ||
(x0, y0), | ||
|
@@ -24901,10 +24901,17 @@ def _updateStat(statInfo, pid, diff, tm, point=None): | |
statInfo["point"].setdefault(point, dict(dflStat)) | ||
pointInfo = statInfo["point"][point] | ||
|
||
if "DRAWTIME" in SysMgr.environList: | ||
core = data.get("core") | ||
# add timeline data # | ||
if "TIMELINE" in SysMgr.environList: | ||
LogMgr.timelineData.append( | ||
[core, point, core, tm - diff, tm] | ||
[ | ||
pid, | ||
point, | ||
statInfo.get("comm"), | ||
"ATRACE", | ||
(tm - diff) * 1000000, | ||
tm * 1000000, | ||
] | ||
) | ||
|
||
pointInfo["count"] += 1 | ||
|
@@ -25899,35 +25906,6 @@ def printTrace(console=False, targets=None, cb=None, parser=None): | |
# check root permission # | ||
SysMgr.checkRootPerm() | ||
|
||
# set atrace properties # | ||
atraceApp = SysMgr.environList.get("ATRACE", []) | ||
if atraceApp: | ||
# set target app # | ||
for i, a in enumerate(atraceApp): | ||
a = "*" if a == "SET" else a | ||
SysMgr.setProp("debug.atrace.app_%s" % i, a, True) | ||
|
||
# set target app number # | ||
SysMgr.setProp( | ||
"debug.atrace.app_number", str(len(atraceApp)), True | ||
) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, ["debug.atrace.app_number", "0", True] | ||
) | ||
|
||
# enable tag flags # | ||
SysMgr.setProp("debug.atrace.tags.enableflags", "1", True) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, | ||
["debug.atrace.tags.enableflags", "0", True], | ||
) | ||
|
||
# enable user initiated flag # | ||
SysMgr.setProp("debug.atrace.user_initiated", "1", True) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, ["debug.atrace.user_initiated", "0", True] | ||
) | ||
|
||
# validate event ## | ||
for t in targets: | ||
if "*" in t: | ||
|
@@ -26476,8 +26454,6 @@ def printAndLog(console=False): | |
if "TIMELINE" in SysMgr.environList: | ||
# create a task object # | ||
taskObj = TaskAnalyzer(onlyInstance=True) | ||
taskObj.timelineIdx = {} | ||
taskObj.timelineData = {"time_unit": "us", "segments": []} | ||
else: | ||
taskObj = None | ||
|
||
|
@@ -31204,6 +31180,36 @@ def splitFile( | |
) | ||
return pathList | ||
|
||
@staticmethod | ||
def enableAtrace(): | ||
atraceApp = SysMgr.environList.get("ATRACE", []) | ||
if atraceApp: | ||
# set target app # | ||
for i, a in enumerate(atraceApp): | ||
a = "*" if a == "SET" else a | ||
SysMgr.setProp("debug.atrace.app_%s" % i, a, True) | ||
|
||
# set target app number # | ||
SysMgr.setProp( | ||
"debug.atrace.app_number", str(len(atraceApp)), True | ||
) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, ["debug.atrace.app_number", "0", True] | ||
) | ||
|
||
# enable tag flags # | ||
SysMgr.setProp("debug.atrace.tags.enableflags", "1", True) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, | ||
["debug.atrace.tags.enableflags", "0", True], | ||
) | ||
|
||
# enable user initiated flag # | ||
SysMgr.setProp("debug.atrace.user_initiated", "1", True) | ||
SysMgr.addExitFunc( | ||
SysMgr.setProp, ["debug.atrace.user_initiated", "0", True] | ||
) | ||
|
||
@staticmethod | ||
def doLess(inputArg=None): | ||
pipeInput = None | ||
|
@@ -38849,6 +38855,13 @@ def printHelp(force=False, isExit=True): | |
# {0:1} {1:1} {3:1} -q STROKEINTERVAL:3000 | ||
# {0:1} {1:1} {3:1} -q STROKEDURATION:3000 | ||
|
||
- {2:1} on absolute / relative timeline | ||
# {0:1} {1:1} {4:1} -q ABSTIME | ||
# {0:1} {1:1} {4:1} -q RELTIME | ||
|
||
- {2:1} for timeline segments of atrace logs | ||
# {0:1} {1:1} {4:1} -q ATRACE, TIMELINE | ||
|
||
- {2:1} to specific image format | ||
# {0:1} {1:1} {4:1} -F png | ||
# {0:1} {1:1} {4:1} -F pdf | ||
|
@@ -38870,12 +38883,6 @@ def printHelp(force=False, isExit=True): | |
# {0:1} {1:1} {4:1} -q TRIM:11: | ||
# {0:1} {1:1} {4:1} -q TRIM:11.9:13.5, ABSTIME | ||
|
||
- {2:1} on absolute timeline | ||
# {0:1} {1:1} {4:1} -q ABSTIME | ||
|
||
- {2:1} on relative timeline | ||
# {0:1} {1:1} {4:1} -q RELTIME | ||
|
||
- {2:1} only having backtrace for the flame graph | ||
# {0:1} {1:1} {4:1} -q ONLYBTSTACK | ||
|
||
|
@@ -39988,8 +39995,8 @@ 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} based on the specific file with atrace logs | ||
# {0:1} {1:1} trace.dat -q ATRACE | ||
|
||
- {3:1} {2:1} to guider.out after converting all target inodes to paths from specific directory | ||
# {0:1} {1:1} -o . -q CONVINODE | ||
|
@@ -78400,6 +78407,9 @@ def enableTracing(): | |
|
||
@staticmethod | ||
def enableEvents(targets=[], start=False): | ||
# set atrace properties # | ||
SysMgr.enableAtrace() | ||
|
||
if not targets and not "ENABLETP" in SysMgr.environList: | ||
return | ||
|
||
|
@@ -121718,11 +121728,23 @@ def drawTimelineItems(): | |
TaskAnalyzer.initDrawEnv() | ||
|
||
# check absolute timeline option # | ||
sysStart = float(SysMgr.startTime) | ||
if "ABSTIME" in SysMgr.environList: | ||
start = float(SysMgr.startTime) | ||
start = sysStart | ||
else: | ||
start = 0 | ||
|
||
# add timeline data # | ||
sysStartUs = sysStart * 1000000 | ||
for d in LogMgr.timelineData: | ||
d[4] -= sysStartUs | ||
d[5] -= sysStartUs | ||
tobj.addTimelineData(*d) | ||
|
||
# check timeline data # | ||
if not hasattr(tobj, "timelineData"): | ||
return | ||
|
||
# minimize system info for annotation # | ||
if SysMgr.sysinfoBuffer: | ||
annotation = SysMgr.sysinfoBuffer | ||
|
@@ -122022,9 +122044,11 @@ def _mergeTasks(atype): | |
|
||
# save max # | ||
nstats[n].setdefault( | ||
comm, {"average": sums, "minimum": 1} | ||
comm, | ||
{"average": sums, "minimum": 1, "count": 0}, | ||
) | ||
nstats[n][comm][maxName] = maxval | ||
nstats[n][comm]["count"] += 1 | ||
|
||
# save diff # | ||
if atype: | ||
|
@@ -122046,11 +122070,17 @@ def _mergeTasks(atype): | |
# save max # | ||
statStr = " ".join(list(map(str, diffList))) | ||
nstats[n].setdefault( | ||
comm, {"average": sum(diffList), "minimum": 1} | ||
comm, | ||
{ | ||
"average": sum(diffList), | ||
"minimum": 1, | ||
"count": 0, | ||
}, | ||
) | ||
nstats[n][comm][maxName] = max( | ||
defMax, max(diffList) | ||
) | ||
nstats[n][comm]["count"] += 1 | ||
|
||
# save diff # | ||
if atype: | ||
|
@@ -124171,18 +124201,18 @@ def _drawCpu(graphStats, xtype, pos, size, delay=False): | |
|
||
# get max cpu condition # | ||
maxCpuCond = UtilMgr.getEnvironNum( | ||
"MAXCPUCOND", False, 0, False, True | ||
"MAXCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
# get avg cpu condition # | ||
avgCpuCond = UtilMgr.getEnvironNum( | ||
"AVGCPUCOND", False, 0, False, True | ||
"AVGCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
# get min cpu condition # | ||
if "MINCPUCOND" in SysMgr.environList: | ||
minCpuCond = UtilMgr.getEnvironNum( | ||
"MINCPUCOND", False, 0, False, True | ||
"MINCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
else: | ||
minCpuCond = 0 | ||
|
@@ -127060,18 +127090,18 @@ def _drawAvgCpu(graphStats, xtype, pos, size): | |
|
||
# get max cpu condition # | ||
maxCpuCond = UtilMgr.getEnvironNum( | ||
"MAXCPUCOND", False, 0, False, True | ||
"MAXCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
# get avg cpu condition # | ||
avgCpuCond = UtilMgr.getEnvironNum( | ||
"AVGCPUCOND", False, 0, False, True | ||
"AVGCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
# get min cpu condition # | ||
if "MINCPUCOND" in SysMgr.environList: | ||
minCpuCond = UtilMgr.getEnvironNum( | ||
"MINCPUCOND", False, 0, False, True | ||
"MINCPUCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
else: | ||
minCpuCond = 0 | ||
|
@@ -127312,7 +127342,7 @@ def __drawSystemMem(statList, color, ymax): | |
if SysMgr.vssEnable: | ||
# get max vss condition # | ||
maxVssCond = UtilMgr.getEnvironNum( | ||
"MAXVSSCOND", False, 0, False, True | ||
"MAXVSSCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
for key, item in sorted( | ||
|
@@ -127374,7 +127404,7 @@ def __drawSystemMem(statList, color, ymax): | |
elif SysMgr.rssEnable or SysMgr.pssEnable or SysMgr.ussEnable: | ||
# get max rss condition # | ||
maxRssCond = UtilMgr.getEnvironNum( | ||
"MAXRSSCOND", False, 0, False, True | ||
"MAXRSSCOND", False, -(SysMgr.maxSize), False, True | ||
) | ||
|
||
for key, item in sorted( | ||
|
@@ -137199,11 +137229,15 @@ def handleUserEvent(self, event, time): | |
def addTimelineData(self, group, text, task, state, start, end): | ||
# convert group id from core to task # | ||
if "PERTASK" in SysMgr.environList: | ||
if not hasattr(self, "timelineIdx"): | ||
self.timelineIdx = {} | ||
if not task in self.timelineIdx: | ||
self.timelineIdx[task] = task | ||
group = self.timelineIdx[task] | ||
|
||
# add timeline data # | ||
if not hasattr(self, "timelineData"): | ||
self.timelineData = {"time_unit": "us", "segments": []} | ||
self.timelineData.setdefault("segments", []) | ||
self.timelineData["segments"].append( | ||
{ | ||
|