diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-11-28 16:33:22 -0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-11-28 16:33:22 -0200 |
commit | ec5422ba5e292add4ee61f95b051d62bdbfca7b5 (patch) | |
tree | e438976e0608dda5d21cce96d927c9bc083e83f6 | |
parent | c9497303692d330b7192da96df2276cafee401b8 (diff) | |
download | tuna-ec5422ba5e292add4ee61f95b051d62bdbfca7b5.tar.gz |
cmdline: Use '+'/'-' optional operations on threads and irqs too
As we were already using for cpus/sockets, so that if '-' or
'+' is not used the operation will reset both the thread and the
irq list, establishing the now selected components as the new list
and reseting the other list, so:
[root@emilia tuna]# tuna -t sshd -S 1 -m -q eth0 -S 0 -m
[root@emilia tuna]#
Will:
1. select all the sshd processes, setting the thread list
2. select the second CPU socket (cores 1,3,5,7)
3. move the selected processes to the selected cpus
4. select the eth0 IRQ, resetting the thread list
5. select the first CPU socket (cores 0,2,4,6)
6. move the selected IRQs (and threads, this time none) to the selected cpus
To see the results we can use:
[root@emilia tuna]# tuna -t sshd -q +eth0 -P
thread ctxt_switches
pid SCHED_ rtpri affinity voluntary nonvoluntary cmd
7178 FIFO 85 0,2,4,6 32620 3 IRQ-2293 eth0(tg3)
7538 FIFO 90 1,3,5,7 9 5 sshd
7926 FIFO 90 1,3,5,7 6293 288 sshd
7988 FIFO 90 1,3,5,7 194 80 sshd
7992 FIFO 90 1,3,5,7 27565 13 sshd
[root@emilia tuna]#
That is: select all "sshd" threads and also the IRQ "eth0".
Previously the above operation would move _both_ the sshd processes
and the eth0 IRQ to the first CPU socket (-S 0), i.e. it would be
equivalent now to:
[root@emilia tuna]# tuna -t sshd -S 1 -m -q +eth0 -S 0 -m
[root@emilia tuna]#
So now all the managed entities: cpus (and sockets), threads and irqs
use the '+' (add to the current list), '-' (remove from the current list)
or no prefix to mean "reset the current list, setting it to this instead".
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tuna-cmd.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tuna-cmd.py b/tuna-cmd.py index 120abea..ad9d096 100755 --- a/tuna-cmd.py +++ b/tuna-cmd.py @@ -268,9 +268,13 @@ def main(): elif o in ("-C", "--affect_children"): affect_children = True elif o in ("-t", "--threads"): - thread_list = reduce(lambda i, j: i + j, - map(thread_mapper, a.split(","))) - thread_list = list(set(thread_list)) + (op, a) = pick_op(a) + op_list = reduce(lambda i, j: i + j, + map(thread_mapper, a.split(","))) + op_list = list(set(op_list)) + thread_list = do_list_op(op, thread_list, op_list) + if not op: + irq_list = None elif o in ("-f", "--filter"): filter = True elif o in ("-g", "--gui"): @@ -329,7 +333,11 @@ def main(): elif o in ("-K", "--no_kthreads"): kthreads = False elif o in ("-q", "--irqs"): - irq_list = a.split(",") + (op, a) = pick_op(a) + op_list = list(set(a.split(","))) + irq_list = do_list_op(op, irq_list, op_list) + if not op: + thread_list = None elif o in ("-U", "--no_uthreads"): uthreads = False elif o in ("-v", "--version"): |