Skip to content

Commit 8446572

Browse files
Bojun-Seoyonghong-song
authored andcommitted
tools/softirqs: Print results in descending order
Users are usually interested in events that happen frequently and consume more time. So, print the results in descending order.
1 parent cb3ca18 commit 8446572

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

tools/softirqs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def vec_to_name(vec):
208208
dist.print_log2_hist(label, "softirq", section_print_fn=vec_to_name)
209209
else:
210210
print("%-16s %11s" % ("SOFTIRQ", "TOTAL_" + label))
211-
for k, v in sorted(dist.items(), key=lambda dist: dist[1].value):
211+
for k, v in sorted(dist.items(), key=lambda dist: -dist[1].value):
212212
print("%-16s %11d" % (vec_to_name(k.vec), v.value / factor))
213213
dist.clear()
214214

tools/softirqs_example.txt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ in-kernel for efficiency. For example:
88
Tracing soft irq event time... Hit Ctrl-C to end.
99
^C
1010
SOFTIRQ TOTAL_usecs
11-
rcu_process_callbacks 974
12-
run_rebalance_domains 1809
13-
run_timer_softirq 2615
14-
net_tx_action 14605
15-
tasklet_action 38692
1611
net_rx_action 88188
12+
tasklet_action 38692
13+
net_tx_action 14605
14+
run_timer_softirq 2615
15+
run_rebalance_domains 1809
16+
rcu_process_callbacks 974
1717

1818
The SOFTIRQ column prints the interrupt action function name. While tracing,
1919
the net_rx_action() soft interrupt ran for 20199 microseconds (20 milliseconds)
@@ -32,30 +32,30 @@ Tracing soft irq event time... Hit Ctrl-C to end.
3232

3333
22:29:16
3434
SOFTIRQ TOTAL_usecs
35-
rcu_process_callbacks 456
36-
run_rebalance_domains 1005
37-
run_timer_softirq 1196
38-
net_tx_action 2796
39-
tasklet_action 5534
4035
net_rx_action 15075
36+
tasklet_action 5534
37+
net_tx_action 2796
38+
run_timer_softirq 1196
39+
run_rebalance_domains 1005
40+
rcu_process_callbacks 456
4141

4242
22:29:17
4343
SOFTIRQ TOTAL_usecs
44-
rcu_process_callbacks 456
45-
run_rebalance_domains 839
46-
run_timer_softirq 1142
47-
net_tx_action 1912
48-
tasklet_action 4428
4944
net_rx_action 14652
45+
tasklet_action 4428
46+
net_tx_action 1912
47+
run_timer_softirq 1142
48+
run_rebalance_domains 839
49+
rcu_process_callbacks 456
5050

5151
22:29:18
5252
SOFTIRQ TOTAL_usecs
53-
rcu_process_callbacks 502
54-
run_rebalance_domains 840
55-
run_timer_softirq 1192
56-
net_tx_action 2341
57-
tasklet_action 5496
5853
net_rx_action 15656
54+
tasklet_action 5496
55+
net_tx_action 2341
56+
run_timer_softirq 1192
57+
run_rebalance_domains 840
58+
rcu_process_callbacks 502
5959

6060
This can be useful for quantifying where CPU cycles are spent among the soft
6161
interrupts (summarized as the %softirq column from mpstat(1), and shown as
@@ -186,12 +186,12 @@ of times. You can use the -C or --events option:
186186
Tracing soft irq events... Hit Ctrl-C to end.
187187
^C
188188
SOFTIRQ TOTAL_count
189-
block 5
190-
tasklet 6
191-
net_rx 402
192-
sched 5251
193-
rcu 5748
194189
timer 9530
190+
rcu 5748
191+
sched 5251
192+
net_rx 402
193+
tasklet 6
194+
block 5
195195

196196

197197
USAGE message:

0 commit comments

Comments
 (0)