Skip to content

Commit

Permalink
printtrace: Add EXCEPTME option
Browse files Browse the repository at this point in the history
Signed-off-by: iipeace <[email protected]>
  • Loading branch information
iipeace committed Sep 16, 2024
1 parent 97c4ba0 commit f0fc940
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 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__ = "240915"
__revision__ = "240916"
__maintainer__ = "Peace Lee"
__email__ = "[email protected]"
__repository__ = "https://github.com/iipeace/guider"
Expand Down Expand Up @@ -25572,7 +25572,7 @@ def printTrace(console=False, targets=None, cb=None, parser=None):
SysMgr.clearFilters(targets)

# apply filters #
SysMgr.applyEventFilters()
SysMgr.applyEventFilters(targets)

# set trace option #
SysMgr.setTraceOpt()
Expand Down Expand Up @@ -43175,6 +43175,9 @@ def _getDesc(s, t=0):
- {2:1} only having specific words
# {0:1} {1:1} "*" -g test, kworker

- {2:1} except for things about me
# {0:1} {1:1} "*" -q EXCEPTME

- {2:1} after applying filters
# {0:1} {1:1} "*" -q TPFILTER:"sched:common_pid==895"

Expand Down Expand Up @@ -77774,11 +77777,21 @@ def clearFilters(targets=["*"]):
SysMgr.printInfo("[done]", prefix=False, title=False)

@staticmethod
def applyEventFilters():
def applyEventFilters(targets=[]):
# add filter for EXCEPTME #
addExceptMe = True
exceptMe = "EXCEPTME" in SysMgr.environList
filters = SysMgr.environList.get("TPFILTER", [])
if not filters:
return
if exceptMe:
filters = [
t + ":common_pid != %s" % SysMgr.pid for t in targets
]
addExceptMe = False
else:
return

# apply filters #
for f in filters:
fitem = f.split(":", 1)
if len(fitem) == 1:
Expand All @@ -77788,6 +77801,9 @@ def applyEventFilters():
filters = fitem[0].split("|")
value = fitem[1]

if exceptMe and addExceptMe:
value += " && common_pid != %s" % SysMgr.pid

SysMgr.printInfo(
r"apply trace filter [%s] for '%s'... "
% (value, ", ".join(filters)),
Expand Down

0 comments on commit f0fc940

Please sign in to comment.