From 656b899446c515ad5ab37e3dba4c8131d4007f4d Mon Sep 17 00:00:00 2001 From: iipeace Date: Fri, 24 Nov 2023 08:19:42 +0900 Subject: [PATCH] ctop: Add NOREP options to remove useless info Signed-off-by: iipeace --- guider/guider.py | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/guider/guider.py b/guider/guider.py index 839ae56a..69b4d008 100755 --- a/guider/guider.py +++ b/guider/guider.py @@ -7,7 +7,7 @@ __credits__ = "Peace Lee" __license__ = "GPLv2" __version__ = "3.9.8" -__revision__ = "231122" +__revision__ = "231123" __maintainer__ = "Peace Lee" __email__ = "iipeace5@gmail.com" __repository__ = "https://github.com/iipeace/guider" @@ -31062,7 +31062,7 @@ def _checkPerm(item): # set report table # SysMgr.reportEnable = True - if SysMgr.findOption("j"): + if SysMgr.findOption("j") and not SysMgr.environList.get("NOPROCRANK"): SysMgr.rankProcEnable = True else: SysMgr.rankProcEnable = False @@ -36604,8 +36604,8 @@ def _getDesc(s, t=0): - {2:1} {3:1} and report in JSON format every interval # {0:1} {1:1} -j -Q -q TEXTREPORT - # {0:1} {1:1} -j -o /tmp -q TEXTREPORT - # {0:1} {1:1} -C /tmp/guider.conf -j -o /tmp -q TEXTREPORT + # {0:1} {1:1} -j -o /tmp -q TEXTREPORT, NOPROCRANK + # {0:1} {1:1} -j -o /tmp -q TEXTREPORT -C /tmp/guider.conf - {2:1} {3:1} and report in JSON format with contents of specific files or directories every interval # {0:1} {1:1} -j -Q -q TEXTREPORT, RECFILE:/tmp/setting1, RECFILE:/tmp/setting2 @@ -36685,6 +36685,12 @@ def _getDesc(s, t=0): - {2:1} without socket profiling # {0:1} {1:1} -q NOSOCKPROF + - {2:1} without specific file report contents + # {0:1} {1:1} -J -q NOSTORAGEREP, NOGPUMEMREP + + - {2:1} with optimized options + # {0:1} {1:1} -j /tmp/perf.report -i 3 -o /data -q TEXTREPORT, NOSOCKPROF, LIMITREPDIR:100M, LIMITDIRCNT:/data/mini:1, NOPROCRANK, NOSTORAGEREP, NOGPUMEMREP -b 3M -e dC + See the top COMMAND help for more examples. """.format( cmd, @@ -137962,18 +137968,14 @@ def _setDefaultInfo(data, pid, comm, runtime=None): self.reportData["gpumem"] = {"total": total, "procs": procs} # remove not-mounted storage status # - if "storage" in self.reportData: - for item in list(self.reportData["storage"]): - try: - if ( - self.reportData["storage"][item]["mount"]["path"] - == "-" - ): - self.reportData["storage"].pop(item, None) - except SystemExit: - sys.exit(0) - except: - pass + for item, val in self.reportData["storage"].items(): + try: + if val["mount"]["path"] == "-": + self.reportData["storage"].pop(item, None) + except SystemExit: + sys.exit(0) + except: + pass # add task status # if "task" in self.reportData: @@ -138070,7 +138072,7 @@ def _setDefaultInfo(data, pid, comm, runtime=None): # make output path # filePath = os.path.dirname(SysMgr.inputFile) + "/guider" - for event in list(self.reportData["event"]): + for event in self.reportData["event"]: filePath = "%s_%s" % (filePath, event) filePath = "%s_%s.out" % (filePath, str(long(SysMgr.uptime))) @@ -138096,6 +138098,12 @@ def _setDefaultInfo(data, pid, comm, runtime=None): "failed to rename %s to %s" % SysMgr.inputFile, filePath ) + # remove useless info for file report # + if "NOSTORAGEREP" in SysMgr.environList: + self.reportData.pop("storage") + if "NOGPUMEMREP" in SysMgr.environList: + self.reportData.pop("gpumem") + # convert dict data to JSON string # pretty = not SysMgr.streamEnable jsonStr = UtilMgr.convDict2Str(