From 726ffe4e052812d9742755e1f0905612407216d1 Mon Sep 17 00:00:00 2001 From: Peace Lee Date: Fri, 20 Mar 2020 17:15:24 +0900 Subject: [PATCH] Change priority and affinity options in top mode Signed-off-by: Peace Lee --- guider/guider.py | 881 ++++++++++++++++++++++------------------------- 1 file changed, 421 insertions(+), 460 deletions(-) diff --git a/guider/guider.py b/guider/guider.py index 73c60164..e29096b5 100755 --- a/guider/guider.py +++ b/guider/guider.py @@ -12382,7 +12382,6 @@ class SysMgr(object): preemptGroup = [] filterGroup = [] schedFilter = [] - schedAllFilter = [] affinityFilter = [] killFilter = [] syscallList = [] @@ -13095,9 +13094,20 @@ def parseAffinityOption(jobs, launch=False): raise Exception('wrong input') if launch: + # check tid # + if UtilMgr.isNumber(tid): + isTid = True + else: + isTid = False + + withSibling = SysMgr.groupProcEnable targetList = SysMgr.getPids(\ - tid, isThread=True, withSibling=SysMgr.groupProcEnable) + tid, isTid=isTid, isThread=True, withSibling=withSibling) targetList = list(map(long, targetList)) + if not targetList: + SysMgr.printErr(\ + "No threads related to %s" % tid) + sys.exit(0) SysMgr.setAffinity(mask, targetList) if len(value) == 3 and value[2].upper() == 'CONT': @@ -14283,66 +14293,66 @@ def printHelp(): mode = sys.argv[1] topCommonStr = ''' - -o save output data - -u run in the background - -W wait for signal - -b set buffer size - -T set font path - -j set report path - -w set additional command - -x set local address - -X set request address - -N set report address - -S - -P group threads in a same process - -I set input path - -m set terminal size - -a show all stats and events - -g set filter - -i set interval - -R set repeat count - -Q print all rows in a stream - -J print in JSON format - -E set cache dir path - -H set function depth level - -k set signal list - -z set cpu affinity list - -Y - -v verbose + -o save output data + -u run in the background + -W wait for signal + -b set buffer size + -T set font path + -j set report path + -w set additional command + -x set local address + -X set request address + -N set report address + -S + -P group threads in a same process + -I set input path + -m set terminal size + -a show all stats and events + -g set filter + -i set interval + -R set repeat count + -Q print all rows in a stream + -J print in JSON format + -E set cache dir path + -H set function depth level + -k set signal list + -z set cpu affinity list + -Y + -v verbose ''' topSubStr = ''' Options: - -e enable options - a:affinity | b:block | c:cpu | C:cgroup - d:disk | D:DLT | e:encode | E:Elastic - f:float | F:wfc | h:sigHandler | H:sched - i:irq | j:journal | k:kmsg | L:cmdline - m:memory | n:net | N:namespace | o:oomScore - p:pipe | P:perf | r:report | R:fileReport - s:stack | S:pss | t:thread | u:uss | w:wss - W:wchan | y:syslog - -d disable options - a:memAvailable | A:cpuAverage - c:cpu | e:encode | G:gpu | L:log - p:print | t:truncate | T:task + -e enable options + a:affinity | b:block | c:cpu | C:cgroup + d:disk | D:DLT | e:encode | E:Elastic + f:float | F:wfc | h:sigHandler | H:sched + i:irq | j:journal | k:kmsg | L:cmdline + m:memory | n:net | N:namespace | o:oomScore + p:pipe | P:perf | r:report | R:fileReport + s:stack | S:pss | t:thread | u:uss | w:wss + W:wchan | y:syslog + -d disable options + a:memAvailable | A:cpuAverage + c:cpu | e:encode | G:gpu | L:log + p:print | t:truncate | T:task ''' drawSubStr = ''' Options: - -g set filter - -o save output data - -a show all stats and events - -T set top number - -L set graph Layout - -l set boundary lines - -E set cache dir path - -v verbose + -g set filter + -o save output data + -a show all stats and events + -T set top number + -L set graph Layout + -l set boundary lines + -E set cache dir path + -v verbose ''' topExamStr = ''' @@ -14512,9 +14522,9 @@ def printHelp(): Log a message Options: - -v verbose - -R set repeat count - -I set log message + -v verbose + -R set repeat count + -I set log message Examples: - Log a message @@ -14529,10 +14539,10 @@ def printHelp(): Print messages in real-time Options: - -v verbose - -g set filter - -I set path / field - -o save output data + -v verbose + -g set filter + -I set path / field + -o save output data Examples: - Print messages in real-time @@ -14557,50 +14567,50 @@ def printHelp(): helpStr += ''' Options: - [collect] - -e enable options - b:block | c:cgroup | e:encode | g:graph - h:heap | L:lock | m:memory | p:pipe - -d disable options - a:all | c:cpu | C:compress | e:encode - l:latency | L:log | u:user - -s save trace data - -f force execution - -u run in the background - -b set buffer size - -t trace syscall - -C set command script path - -W wait for signal - -w set additional command - -M set objdump path - -U set user event - -K set kernel event - - [report] - -o save output data - -S - -P group threads in a same process - -O set core filter - -l set addr2line path - -r set root path - -m set terminal size - - [common] - -a show all stats and events - -g set filter - -R set repeat count - -Q print all rows in a stream - -A set cpu type - -c set custom event - -E set cache dir path - -H set function depth level - -k set signal list - -z set cpu affinity list - -Y - -v verbose + [collect] + -e enable options + b:block | c:cgroup | e:encode | g:graph + h:heap | L:lock | m:memory | p:pipe + -d disable options + a:all | c:cpu | C:compress | e:encode + l:latency | L:log | u:user + -s save trace data + -f force execution + -u run in the background + -b set buffer size + -t trace syscall + -C set command script path + -W wait for signal + -w set additional command + -M set objdump path + -U set user event + -K set kernel event + + [report] + -o save output data + -S + -P group threads in a same process + -O set core filter + -l set addr2line path + -r set root path + -m set terminal size + + [common] + -a show all stats and events + -g set filter + -R set repeat count + -Q print all rows in a stream + -A set cpu type + -c set custom event + -E set cache dir path + -H set function depth level + -k set signal list + -z set cpu affinity list + -Y + -v verbose ''' helpStr += ''' @@ -14663,21 +14673,21 @@ def printHelp(): helpStr += ''' Options: - -e enable options - p:pipe | e:encode - -d disable options - e:encode - -s save trace data - -u run in the background - -W wait for signal - -w set additional command - -o save output data - -m set terminal size - -a show all stats and events - -g set filter - -Q print all rows in a stream - -E set cache dir path - -v verbose + -e enable options + p:pipe | e:encode + -d disable options + e:encode + -s save trace data + -u run in the background + -W wait for signal + -w set additional command + -o save output data + -m set terminal size + -a show all stats and events + -g set filter + -Q print all rows in a stream + -E set cache dir path + -v verbose ''' helpStr += ''' @@ -14701,22 +14711,22 @@ def printHelp(): helpStr += ''' Options: - -e enable options - p:pipe | e:encode - -d disable options - e:encode - -s save trace data - -u run in the background - -b set buffer size - -t trace syscall - -W wait for signal - -w set additional command - -o save output data - -m set terminal size - -a show all stats and events - -g set filter - -E set cache dir path - -v verbose + -e enable options + p:pipe | e:encode + -d disable options + e:encode + -s save trace data + -u run in the background + -b set buffer size + -t trace syscall + -W wait for signal + -w set additional command + -o save output data + -m set terminal size + -a show all stats and events + -g set filter + -E set cache dir path + -v verbose ''' helpStr += ''' @@ -14740,17 +14750,17 @@ def printHelp(): helpStr += ''' Options: - -e enable options - p:pipe | e:encode - -d disable options - e:encode - -o save output data - -m set terminal size - -a show all stats and events - -g set filter - -I set input path - -E set cache dir path - -v verbose + -e enable options + p:pipe | e:encode + -d disable options + e:encode + -o save output data + -m set terminal size + -a show all stats and events + -g set filter + -I set input path + -E set cache dir path + -v verbose ''' helpStr += ''' @@ -14774,18 +14784,18 @@ def printHelp(): helpStr += ''' Options: - -e enable options - p:pipe | e:encode - -d disable options - e:encode - -s save trace data - -u run in the background - -W wait for signal - -o save output data - -m set terminal size - -Q print all rows in a stream - -E set cache dir path - -v verbose + -e enable options + p:pipe | e:encode + -d disable options + e:encode + -s save trace data + -u run in the background + -W wait for signal + -o save output data + -m set terminal size + -Q print all rows in a stream + -E set cache dir path + -v verbose ''' helpStr += ''' @@ -14806,50 +14816,50 @@ def printHelp(): helpStr += ''' Options: - [collect] - -e enable options - b:block | c:cgroup | e:encode | g:graph - i:irq | L:lock | m:memory | n:net - p:pipe | r:reset | P:power - -d disable options - a:all | c:cpu | C:compress | e:encode - -s save trace data - -f force execution - -u run in the background - -W wait for signal - -b set buffer size - -D trace thread dependency - -t trace syscall - -C set command script path - -w set additional command - -U set user event - -K set kernel event - -R set repeat count - - [report] - -a show all stats and events - -o save output data - -S - -P group threads in a same process - -p show preemption info - -O set core filter - -L set graph Layout - -m set terminal size - -i set interval - -Q print all rows in a stream - - [common] - -g set filter - -A set cpu type - -c set custom event - -E set cache dir path - -k set signal list - -z set cpu affinity list - -Y - -v verbose + [collect] + -e enable options + b:block | c:cgroup | e:encode | g:graph + i:irq | L:lock | m:memory | n:net + p:pipe | r:reset | P:power + -d disable options + a:all | c:cpu | C:compress | e:encode + -s save trace data + -f force execution + -u run in the background + -W wait for signal + -b set buffer size + -D trace thread dependency + -t trace syscall + -C set command script path + -w set additional command + -U set user event + -K set kernel event + -R set repeat count + + [report] + -a show all stats and events + -o save output data + -S + -P group threads in a same process + -p show preemption info + -O set core filter + -L set graph Layout + -m set terminal size + -i set interval + -Q print all rows in a stream + + [common] + -g set filter + -A set cpu type + -c set custom event + -E set cache dir path + -k set signal list + -z set cpu affinity list + -Y + -v verbose ''' helpStr += ''' @@ -15299,20 +15309,20 @@ def printHelp(): helpStr += ''' Options: - -e enable options - p:pipe | e:encode - -d disable options - e:encode - -u run in the background - -a show all stats including registers - -g set filter - -I set command - -R