diff --git a/guider/guider.conf b/guider/guider.conf index 221e7476..ecf57a10 100644 --- a/guider/guider.conf +++ b/guider/guider.conf @@ -279,7 +279,7 @@ "interval": 3, "perm": "root", "signal": "3:SIGINT", - "command": ["simple-perf record -g -o /data/perf.dat"], + "command": ["simpleperf record -g -o /data/perf.dat"], "message": "system CPU usage is high", "explain": "profile function calls" }, diff --git a/guider/guider.py b/guider/guider.py index 658c11a3..0779b75b 100755 --- a/guider/guider.py +++ b/guider/guider.py @@ -7,7 +7,7 @@ __credits__ = "Peace Lee" __license__ = "GPLv2" __version__ = "3.9.8" -__revision__ = "230925" +__revision__ = "230926" __maintainer__ = "Peace Lee" __email__ = "iipeace5@gmail.com" __repository__ = "https://github.com/iipeace/guider" @@ -33786,9 +33786,9 @@ def getCmdList(): }, "test": { "cputest": ("CPU", "Linux/MacOS/Windows"), - "iotest ": ("Storage", "Linux/MacOS/Windows"), + "iotest": ("Storage", "Linux/MacOS/Windows"), "memtest": ("Memory", "Linux/MacOS/Windows"), - "nettest ": ("Network", "Linux"), + "nettest": ("Network", "Linux"), }, } @@ -33824,6 +33824,7 @@ def printHelp(force=False, isExit=True): mode = sys.argv[1] topCommonStr = """ +Options: -o set output path -u run in the background -W wait for input @@ -34130,6 +34131,9 @@ def printHelp(force=False, isExit=True): # {0:1} {1:1} -q DUMPFILE:/tmp/OUT, DUMPFILESIZE:1024 -o # {0:1} {1:1} -q DUMPFILE:/tmp/OUT, DUMPFILESIZE:-1024 -o + - {3:1} {2:1} only for specific user + # {0:1} {1:1} -q USERFILTER:"root*" + - {3:1} {2:1} including cgroup info # {0:1} {1:1} -e G # {0:1} {1:1} -e G -o @@ -35206,19 +35210,65 @@ def printHelp(force=False, isExit=True): cmd, mode, "Print logs" ) - # function record # - if SysMgr.checkMode("funcrec"): - helpStr = """ + defUsage0 = """ Usage: # {0:1} {1:1} [OPTIONS] [--help] + """.format( + cmd, mode + ) -Description: - Record function events on the system - """.format( - cmd, mode - ) + defUsage1 = """ +Usage: + # {0:1} {1:1} -g | [OPTIONS] [--help] + """.format( + cmd, mode + ) - helpStr += """ + defUsage2 = """ +Usage: + # {0:1} {1:1} -g [OPTIONS] [--help] + """.format( + cmd, mode + ) + + defUsage3 = """ +Usage: + # {0:1} {1:1} -g [OPTIONS] [--help] + """.format( + cmd, mode + ) + + defUsage4 = """ +Usage: + # {0:1} {1:1} -g -c [OPTIONS] [--help] + """.format( + cmd, mode + ) + + defUsage5 = """ +Usage: + # {0:1} {1:1} [OPTIONS] [--help] + """.format( + cmd, mode + ) + + # description formatter # + def _getDesc(s, t=0): + usages = [ + defUsage0, + defUsage1, + defUsage2, + defUsage3, + defUsage4, + defUsage5, + ] + return "%s\nDescription:\n %s\n" % (usages[t], s) + + # function record # + if SysMgr.checkMode("funcrec"): + helpStr = ( + _getDesc("Record function events on the system") + + """ Options: [collect] -e enable options @@ -35263,9 +35313,10 @@ def printHelp(force=False, isExit=True): -z set CPU affinity -Y set sched [ POLICY:PRIO|TIME{:TID|COMM:CONT} - CLASS:{{WHICH:}}PRIO:TID|COMM ] + CLASS:{WHICH:}PRIO:TID|COMM ] -v verbose """ + ) helpStr += """ Examples: @@ -35346,17 +35397,11 @@ def printHelp(force=False, isExit=True): # file record # elif SysMgr.checkMode("filerec"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Report all files loaded on the system memory - """.format( - cmd, mode - ) - - helpStr += """ + helpStr = ( + _getDesc( + "Report all files loaded on the system memory" + ) + + """ Options: -e enable options [ p:pipe | e:encode ] @@ -35379,6 +35424,7 @@ def printHelp(force=False, isExit=True): -E set cache dir path -v verbose """ + ) helpStr += """ Examples: @@ -35434,17 +35480,11 @@ def printHelp(force=False, isExit=True): # report # elif SysMgr.checkMode("report"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Report the results of analyzing the recorded data - """.format( - cmd, mode - ) - - helpStr += """ + helpStr = ( + _getDesc( + "Report the results of analyzing the recorded data" + ) + + """ Options: -e enable options [ p:pipe | e:encode ] @@ -35459,6 +35499,7 @@ def printHelp(force=False, isExit=True): -E set cache dir path -v verbose """ + ) helpStr += """ Examples: @@ -35532,17 +35573,9 @@ def printHelp(force=False, isExit=True): # general record # elif SysMgr.checkMode("genrec"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Record system status - """.format( - cmd, mode - ) - - helpStr += """ + helpStr = ( + _getDesc("Record system status") + + """ Options: -e enable options [ p:pipe | e:encode ] @@ -35559,6 +35592,7 @@ def printHelp(force=False, isExit=True): -E set cache dir path -v verbose """ + ) helpStr += """ Examples: @@ -35579,39 +35613,17 @@ def printHelp(force=False, isExit=True): ): # thread # if SysMgr.checkMode("rec"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Record thread events on the system - """.format( - cmd, mode - ) + desc = "Record thread events on the system" # syscall # elif SysMgr.checkMode("sysrec"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Record syscall events on the system - """.format( - cmd, mode - ) + desc = "Record syscall events on the system" # I/O # else: - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Record I/O events on the system - """.format( - cmd, mode - ) + desc = "Record I/O events on the system" - helpStr += """ + helpStr = ( + _getDesc(desc) + + """ Options: [collect] -e enable options @@ -35661,9 +35673,10 @@ def printHelp(force=False, isExit=True): -z set CPU affinity -Y set sched [ POLICY:PRIO|TIME{:TID|COMM:CONT} - CLASS:{{WHICH:}}PRIO:TID|COMM ] + CLASS:{WHICH:}PRIO:TID|COMM ] -v verbose """ + ) helpStr += """ * uprobe @@ -35815,15 +35828,7 @@ def printHelp(force=False, isExit=True): elif SysMgr.checkMode("ftop"): fileTopStr = topCommonStr - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor open files on the system - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor open files on the system") examStr = """ Examples: @@ -35876,30 +35881,14 @@ def printHelp(force=False, isExit=True): # thread top # elif SysMgr.checkMode("ttop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of threads - """.format( - cmd, mode - ) - + helpStr = _getDesc("Monitor the status of threads") helpStr += topSubStr + topCommonStr + topExamStr # cgroup top # elif SysMgr.checkMode("cgtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of cgroup on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor the status of cgroup on the system" ) - helpStr += topSubStr + topCommonStr + topExamStr helpStr += """ @@ -35931,14 +35920,8 @@ def printHelp(force=False, isExit=True): # vmalloc top # elif SysMgr.checkMode("vtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor memory objects allocated using vmalloc on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor memory objects allocated using vmalloc on the system" ) examStr = """ @@ -35958,20 +35941,15 @@ def printHelp(force=False, isExit=True): # slab top # elif SysMgr.checkMode("slabtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor slab objects on the system - + helpStr = ( + _getDesc("Monitor slab objects on the system") + + """ Sort: size: the size of an object active: the number of active objects actsize: the size of active objects total: the size of all objects - """.format( - cmd, mode + """ ) examStr = """ @@ -35997,14 +35975,8 @@ def printHelp(force=False, isExit=True): # syscall top # elif SysMgr.checkMode("systop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor syscalls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor syscalls for specific threads", t=1 ) examStr = """ @@ -36051,14 +36023,9 @@ def printHelp(force=False, isExit=True): # python top # elif SysMgr.checkMode("pytop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor python calls for specific threads (support up to Python 3.11) - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor python calls for specific threads (support up to Python 3.11)", + t=1, ) examStr = ( @@ -36114,15 +36081,7 @@ def printHelp(force=False, isExit=True): # kernel function top # elif SysMgr.checkMode("kftop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor kernel function calls - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor kernel function calls", t=1) helpStr += """ Options: @@ -36157,14 +36116,9 @@ def printHelp(force=False, isExit=True): # kernel top # elif SysMgr.checkMode("ktop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor kernel function calls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor kernel function calls for specific threads", + t=1, ) examStr = """ @@ -36208,14 +36162,9 @@ def printHelp(force=False, isExit=True): # usercall top # elif SysMgr.checkMode("utop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor native function calls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor native function calls for specific threads", + t=1, ) examStr = ( @@ -36288,14 +36237,8 @@ def printHelp(force=False, isExit=True): # break top # elif SysMgr.checkMode("btop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Monitor function calls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor function calls for specific threads", t=1 ) examStr = """ @@ -36310,15 +36253,7 @@ def printHelp(force=False, isExit=True): # all top # elif SysMgr.checkMode("atop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor all resources on the system - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor all resources on the system") examStr = """ Examples: @@ -36334,14 +36269,8 @@ def printHelp(force=False, isExit=True): # tree top # elif SysMgr.checkMode("trtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor tasks on the system in a tree structure - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor tasks on the system in a tree structure" ) examStr = """ @@ -36379,14 +36308,8 @@ def printHelp(force=False, isExit=True): # condition top # elif SysMgr.checkMode("ctop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor resources with threshold on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor resources with threshold on the system" ) examStr = """ @@ -36490,14 +36413,8 @@ def printHelp(force=False, isExit=True): # stack top # elif SysMgr.checkMode("stacktop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Monitor kernel stacks for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor kernel stacks for specific threads", t=3 ) examStr = """ @@ -36514,14 +36431,9 @@ def printHelp(force=False, isExit=True): # perf top # elif SysMgr.checkMode("ptop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Monitor performance stats using PMU(Performance Monitoring Unit) - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor performance stats using PMU(Performance Monitoring Unit)", + t=3, ) examStr = """ @@ -36546,15 +36458,7 @@ def printHelp(force=False, isExit=True): # mem top # elif SysMgr.checkMode("mtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor memory details on the system - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor memory details on the system") vmflagStr = """ Vmflags: @@ -36595,14 +36499,9 @@ def printHelp(force=False, isExit=True): # wss top # elif SysMgr.checkMode("wtop"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Monitor WSS(Working Set Size) for specific processes - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor WSS(Working Set Size) for specific processes", + t=2, ) examStr = """ @@ -36627,14 +36526,8 @@ def printHelp(force=False, isExit=True): # report top # elif SysMgr.checkMode("rtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Report all resources on the system in JSON format - """.format( - cmd, mode + helpStr = _getDesc( + "Report all resources on the system in JSON format" ) examStr = """ @@ -36675,14 +36568,8 @@ def printHelp(force=False, isExit=True): # background top # elif SysMgr.checkMode("bgtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Collect system status in the background until get SIGSTOP - """.format( - cmd, mode + helpStr = _getDesc( + "Collect system status in the background until get SIGSTOP" ) examStr = """ @@ -36702,14 +36589,8 @@ def printHelp(force=False, isExit=True): # irq top # elif SysMgr.checkMode("irqtop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of irqs on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor the status of irqs on the system" ) examStr = """ @@ -36726,14 +36607,8 @@ def printHelp(force=False, isExit=True): # disk top # elif SysMgr.checkMode("disktop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of storage devices on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor the status of storage devices on the system" ) examStr = """ @@ -36758,15 +36633,7 @@ def printHelp(force=False, isExit=True): # DLT top # elif SysMgr.checkMode("dlttop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor DLT logs - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor DLT logs") examStr = """ Examples: @@ -36808,15 +36675,7 @@ def printHelp(force=False, isExit=True): # dbus top # elif SysMgr.checkMode("dbustop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor D-Bus messages - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor D-Bus messages") examStr = """ Examples: @@ -36858,14 +36717,8 @@ def printHelp(force=False, isExit=True): # network top # elif SysMgr.checkMode("ntop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of network devices on the system - """.format( - cmd, mode + helpStr = _getDesc( + "Monitor the status of network devices on the system" ) examStr = """ @@ -36882,15 +36735,7 @@ def printHelp(force=False, isExit=True): # process top # elif SysMgr.isTopMode() and not SysMgr.checkMode("fetop"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Monitor the status of processes - """.format( - cmd, mode - ) + helpStr = _getDesc("Monitor the status of processes") helpStr += topSubStr + topCommonStr + topExamStr @@ -36963,15 +36808,7 @@ def printHelp(force=False, isExit=True): # getpid # elif SysMgr.checkMode("getpid"): - helpStr = """ -Usage: - # {0:1} {1:1} -g KEYWORD [OPTIONS] [--help] - -Description: - Print task ID - """.format( - cmd, mode - ) + helpStr = _getDesc("Print task ID", t=2) helpStr += """ Options: @@ -37013,14 +36850,9 @@ def printHelp(force=False, isExit=True): # strings # elif SysMgr.checkMode("strings"): - helpStr = """ -Usage: - # {0:1} {1:1} -I [OPTIONS] [--help] - -Description: - Print the sequences of printable characters in files - """.format( - cmd, mode + helpStr = _getDesc( + "Print the sequences of printable characters in files", + t=5, ) helpStr += """ @@ -37137,14 +36969,8 @@ def printHelp(force=False, isExit=True): # print # elif SysMgr.checkMode("print"): - helpStr = """ -Usage: - # {0:1} {1:1} -I [OPTIONS] [--help] - -Description: - Print files including compressed data - """.format( - cmd, mode + helpStr = _getDesc( + "Print files including compressed data", t=5 ) helpStr += """ @@ -37197,14 +37023,8 @@ def printHelp(force=False, isExit=True): # dump # elif SysMgr.checkMode("dump"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Dump memory of the specific process - """.format( - cmd, mode + helpStr = _getDesc( + "Dump memory of the specific process", t=3 ) helpStr += """ @@ -37241,14 +37061,8 @@ def printHelp(force=False, isExit=True): # mtrace # elif SysMgr.checkMode("mtrace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace mmap syscalls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Trace mmap syscalls for specific threads", t=1 ) helpStr += """ @@ -37293,14 +37107,8 @@ def printHelp(force=False, isExit=True): # strace # elif SysMgr.checkMode("strace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace syscalls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Trace syscalls for specific threads", t=1 ) helpStr += """ @@ -37403,14 +37211,8 @@ def printHelp(force=False, isExit=True): # utrace # elif SysMgr.checkMode("utrace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace function calls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Trace function calls for specific threads", t=1 ) helpStr += """ @@ -37474,14 +37276,9 @@ def printHelp(force=False, isExit=True): # pytrace # elif SysMgr.checkMode("pytrace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace python calls for specific threads (support up to Python 3.11) - """.format( - cmd, mode + helpStr = _getDesc( + "Trace python calls for specific threads (support up to Python 3.11)", + t=1, ) helpStr += """ @@ -37549,14 +37346,8 @@ def printHelp(force=False, isExit=True): # btrace # elif SysMgr.checkMode("btrace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace native function calls for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Trace native function calls for specific threads", t=1 ) helpStr += """ @@ -37585,14 +37376,8 @@ def printHelp(force=False, isExit=True): # remote # elif SysMgr.checkMode("remote"): - helpStr = """ -Usage: - # {0:1} {1:1} -g -c [OPTIONS] [--help] - -Description: - Execute commands through specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Execute commands through specific threads", t=4 ) helpStr += """ @@ -37726,13 +37511,12 @@ def printHelp(force=False, isExit=True): # hook # elif SysMgr.checkMode("hook"): - helpStr = """ -Usage: - # {0:1} {1:1} -g -c [OPTIONS] [--help] - -Description: - Replace specific functions for specific processes - + helpStr = ( + _getDesc( + "Replace specific functions for specific processes", + t=4, + ) + + """ Caution) This command will update PLTs in mapped binaries. Options: @@ -37755,20 +37539,20 @@ def printHelp(force=False, isExit=True): # {0:1} {1:1} {2:1} -q WAITTASK:1 # {0:1} {1:1} {2:1} -q WAITTASK, NOPIDCACHE """.format( - cmd, - mode, - "-g a.out -c malloc#./libhook.so#mallocHook", + cmd, + mode, + "-g a.out -c malloc#./libhook.so#mallocHook", + ) ) # printbind # elif SysMgr.checkMode("printbind"): - helpStr = """ -Usage: - # {0:1} {1:1} -g -c [OPTIONS] [--help] - -Description: - Print function binding status for specific processes - + helpStr = ( + _getDesc( + "Print function binding status for specific processes", + t=4, + ) + + """ Options: -u run in the background -g set task filter @@ -37790,19 +37574,14 @@ def printHelp(force=False, isExit=True): - Print specific function binding status for a specific process # {0:1} {1:1} -g a.out -c write """.format( - cmd, mode + cmd, mode + ) ) # sigtrace # elif SysMgr.checkMode("sigtrace"): - helpStr = """ -Usage: - # {0:1} {1:1} -g | [OPTIONS] [--help] - -Description: - Trace signals for specific threads - """.format( - cmd, mode + helpStr = _getDesc( + "Trace signals for specific threads", t=1 ) helpStr += """ @@ -37854,14 +37633,8 @@ def printHelp(force=False, isExit=True): # mem # elif SysMgr.checkMode("mem"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Print page attributes for specific processes - """.format( - cmd, mode + helpStr = _getDesc( + "Print page attributes for specific processes", t=2 ) helpStr += """ @@ -37926,113 +37699,55 @@ def printHelp(force=False, isExit=True): # CPU average draw # elif SysMgr.checkMode("drawcpuavg"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw CPU average graphs - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw CPU average graphs", t=5) helpStr += drawSubStr + drawExamStr # memory average draw # elif SysMgr.checkMode("drawmemavg"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw memory average graphs for system - """.format( - cmd, mode + helpStr = _getDesc( + "Draw memory average graphs for system", t=5 ) helpStr += drawSubStr + drawExamStr # VSS average draw # elif SysMgr.checkMode("drawvssavg"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw VSS average graphs for processes - """.format( - cmd, mode + helpStr = _getDesc( + "Draw VSS average graphs for processes", t=5 ) helpStr += drawSubStr + drawExamStr # RSS average draw # elif SysMgr.checkMode("drawrssavg"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw RSS average graphs for processes - """.format( - cmd, mode + helpStr = _getDesc( + "Draw RSS average graphs for processes", t=5 ) helpStr += drawSubStr + drawExamStr # CPU draw # elif SysMgr.checkMode("drawcpu"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw CPU graphs - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw CPU graphs", t=5) helpStr += drawSubStr + drawExamStr # CPU Delay draw # elif SysMgr.checkMode("drawdelay"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw CPU delay graphs - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw CPU delay graphs", t=5) helpStr += drawSubStr + drawExamStr # bitmap draw # elif SysMgr.checkMode("drawbitmap"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw bitmap - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw bitmap", t=5) helpStr += drawSubStr + drawExamStr # violin draw # elif SysMgr.checkMode("drawviolin"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw violin plots - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw violin plots", t=5) myStr = """ - Draw violin plots only for specific items from specific files @@ -38049,15 +37764,7 @@ def printHelp(force=False, isExit=True): # flamegraph draw # elif SysMgr.checkMode("drawflame"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw flame graph - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw flame graph", t=5) myStr = """ - Draw flame graphs with redundant call count @@ -38071,14 +37778,8 @@ def printHelp(force=False, isExit=True): # timeline draw # elif SysMgr.checkMode("drawtime"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw timeline segment from JSON format data - """.format( - cmd, mode + helpStr = _getDesc( + "Draw timeline segment from JSON format data", t=5 ) drawTimelineStr = """ @@ -38144,116 +37845,69 @@ def printHelp(force=False, isExit=True): # memory draw # elif SysMgr.checkMode("drawmem"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw system memory graphs and memory chart - """.format( - cmd, mode + helpStr = _getDesc( + "Draw system memory graphs and memory chart", t=5 ) helpStr += drawSubStr + drawExamStr # vss draw # elif SysMgr.checkMode("drawvss"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw process memory(VSS) graphs and memory chart - """.format( - cmd, mode + helpStr = _getDesc( + "Draw process memory(VSS) graphs and memory chart", t=5 ) helpStr += drawSubStr + drawExamStr # rss draw # elif SysMgr.checkMode("drawrss"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw process memory(RSS) graphs and memory chart - """.format( - cmd, mode + helpStr = _getDesc( + "Draw process memory(RSS) graphs and memory chart", t=5 ) helpStr += drawSubStr + drawExamStr # leak draw # elif SysMgr.checkMode("drawleak"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw memory(VSS) graphs of processes suspected memory leak and memory chart - """.format( - cmd, mode + helpStr = _getDesc( + "Draw memory(VSS) graphs of processes suspected memory leak and memory chart", + t=5, ) helpStr += drawSubStr + drawExamStr # I/O draw # elif SysMgr.checkMode("drawio"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw system I/O graphs - """.format( - cmd, mode - ) + helpStr = _getDesc("Draw system I/O graphs", t=5) helpStr += drawSubStr + drawExamStr # prio draw # elif SysMgr.checkMode("drawpri"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw task scheduling priority graphs - """.format( - cmd, mode + helpStr = _getDesc( + "Draw task scheduling priority graphs", t=5 ) helpStr += drawSubStr + drawExamStr # draw # elif SysMgr.isDrawMode(): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Draw system resource graph, event timeline, memory chart - + helpStr = ( + _getDesc( + "Draw system resource graph, event timeline, memory chart", + t=5, + ) + + """ * The system memory chart is created only when using PSS-enabled report * The event timeline supports sched, block, syscall, mark, custom, user, kernel, off - """.format( - cmd, mode + """ ) helpStr += drawSubStr + drawExamStr # topdiff # elif SysMgr.checkMode("topdiff"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Diff top report files - """.format( - cmd, mode - ) + helpStr = _getDesc("Diff top report files", t=5) helpStr += """ Options: @@ -38308,14 +37962,8 @@ def printHelp(force=False, isExit=True): # topsum # elif SysMgr.checkMode("topsum"): - helpStr = """ -Usage: - # {0:1} {1:1} [OPTIONS] [--help] - -Description: - Summarize a raw file for task top mode - """.format( - cmd, mode + helpStr = _getDesc( + "Summarize a raw file for task top mode", t=5 ) helpStr += """ @@ -38444,21 +38092,16 @@ def printHelp(force=False, isExit=True): # pause # elif SysMgr.checkMode("pause"): - helpStr = """ -Usage: - # {0:1} {1:1} -g [OPTIONS] [--help] - -Description: - Pause specific threads - + helpStr = ( + _getDesc("Pause specific threads", t=3) + + """ Options: -g set task filter -R