CLI: Do not show column headers when not outputting to a tty:
[root@felicio ~]# tuna -q en* -Q
# users affinity
54 enp1s0f0-TxRx-0 0,1,2 ixgbe
55 enp1s0f0-TxRx-1 0,1,2 ixgbe
56 enp1s0f0-TxRx-2 0,1,2 ixgbe
57 enp1s0f0-TxRx-3 0,1,2 ixgbe
58 enp1s0f0 0,1,2 ixgbe
59 enp1s0f1-TxRx-0 0,1,2 ixgbe
60 enp1s0f1-TxRx-1 0,1,2 ixgbe
61 enp1s0f1-TxRx-2 0,1,2 ixgbe
62 enp1s0f1-TxRx-3 0,1,2 ixgbe
63 enp1s0f1 0,1,2 ixgbe
66 enp7s0 0,1,2 atl1c
[root@felicio ~]# tuna -q en* -Q | head -4
54 enp1s0f0-TxRx-0 0,1,2 ixgbe
55 enp1s0f0-TxRx-1 0,1,2 ixgbe
56 enp1s0f0-TxRx-2 0,1,2 ixgbe
57 enp1s0f0-TxRx-3 0,1,2 ixgbe
[root@felicio ~]#
[root@felicio ~]# tuna -t xfs-d* -P
thread ctxt_switches
pid SCHED_ rtpri affinity voluntary nonvoluntary cmd
459 OTHER 0 0,1,2,3 2 1 xfs-data/dm-1
654 OTHER 0 0,1,2,3 2 0 xfs-data/sda1
669 OTHER 0 0,1,2,3 2 0 xfs-data/dm-2
[root@felicio ~]# tuna -t xfs-d* -P | head
459 OTHER 0 0,1,2,3 2 1 xfs-data/dm-1
654 OTHER 0 0,1,2,3 2 0 xfs-data/sda1
669 OTHER 0 0,1,2,3 2 0 xfs-data/dm-2
[root@felicio ~]#
Useful, for instance, when using wc to count how many IRQs or threadas match
some filters.
Signed-off-by: Arnaldo Carvalho de Melo <acme@felicio.ghostprotocols.net>
diff --git a/tuna-cmd.py b/tuna-cmd.py
index f85b629..270e769 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -305,7 +305,8 @@
has_ctxt_switch_info = ps[1]["status"].has_key("voluntary_ctxt_switches")
try:
- ps_show_header(has_ctxt_switch_info, cgroups)
+ if sys.stdout.isatty():
+ ps_show_header(has_ctxt_switch_info, cgroups)
ps_show(ps, affect_children, thread_list,
cpu_list, irq_list, show_uthreads, show_kthreads,
has_ctxt_switch_info, sock_inodes, sock_inode_re, cgroups)
@@ -334,7 +335,8 @@
if not irqs:
irqs = procfs.interrupts()
- print "%4s %-16s %8s" % ("#", _("users"), _("affinity"),)
+ if sys.stdout.isatty():
+ print "%4s %-16s %8s" % ("#", _("users"), _("affinity"),)
sorted_irqs = []
for k in irqs.keys():
try: