From f0fc940a4462390f3afded959985a5cadee26023 Mon Sep 17 00:00:00 2001 From: iipeace Date: Mon, 16 Sep 2024 22:09:03 +0900 Subject: [PATCH] printtrace: Add EXCEPTME option Signed-off-by: iipeace --- guider/guider.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/guider/guider.py b/guider/guider.py index fe4464ff..f331b082 100755 --- a/guider/guider.py +++ b/guider/guider.py @@ -7,7 +7,7 @@ __credits__ = "Peace Lee" __license__ = "GPLv2" __version__ = "3.9.8" -__revision__ = "240915" +__revision__ = "240916" __maintainer__ = "Peace Lee" __email__ = "iipeace5@gmail.com" __repository__ = "https://github.com/iipeace/guider" @@ -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() @@ -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" @@ -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: @@ -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)),