summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-01-09 11:28:44 -0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2009-01-09 11:28:44 -0200
commita1b20bdff0072a4cb49d12e9faa8de62412230e6 (patch)
treec91998eaa735fe9ba41c369fb238bb61129d71fb
parentbcba521b43261e46e4c599a826e0f05504a3ef85 (diff)
downloadtuna-a1b20bdff0072a4cb49d12e9faa8de62412230e6.tar.gz
cmdline: Support regex on --thread
Example: [root@doppio tuna]# tuna -t f.*,c.*,sshd -P thread ctxt_switches pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 176 OTHER 0 0,1 2 0 cqueue 1054 OTHER 0 0,1 2244 71 crond 1079 OTHER 0 0,1 11080375 8288735 firefox 1093 OTHER 0 0,1 37 38 cupsd 2317 OTHER 0 0,1 4566 463 console-kit-dae 5521 OTHER 0 0,1 12515 1809 clock-applet 32286 OTHER 0 0,1 29 11 sshd [root@doppio tuna]# Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xtuna-cmd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 29fab54..aadfa03 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-import getopt, ethtool, procfs, schedutils, sys
+import getopt, ethtool, procfs, re, schedutils, sys
from tuna import tuna, sysfs
try:
@@ -223,7 +223,10 @@ def thread_mapper(s):
if not ps:
ps = procfs.pidstats()
- return ps.find_by_name(s)
+ try:
+ return ps.find_by_regex(re.compile(s))
+ except:
+ return ps.find_by_name(s)
def pick_op(argument):
if argument[0] in ('+', '-'):