diff options
| author | Takashi Iwai <tiwai@suse.de> | 2019-04-11 08:36:30 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2019-04-11 08:36:30 -0400 |
| commit | 9b0dcd0e5a27958b57e3e390f63c098d63a055da (patch) | |
| tree | de778d683f121d3062df316994e9c4cf195eb12c /tools/perf/scripts/python/netdev-times.py | |
| parent | d7a181da2dfa3190487c446042ba01e07d851c74 (diff) | |
| parent | ac71317e6be01812cc0c54d8be6d3c1139c8380b (diff) | |
Merge tag 'asoc-fix-v5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.1
A few core fixes along with the driver specific ones, mainly fixing
small issues that only affect x86 platforms for various reasons (their
unusual machine enumeration mechanisms mainly, plus a fix for error
handling in topology).
There's some of the driver fixes that look larger than they are, like
the hdmi-codec changes which resulted in an indentation change, and most
of the other large changes are for new drivers like the STM32 changes.
Diffstat (limited to 'tools/perf/scripts/python/netdev-times.py')
| -rw-r--r-- | tools/perf/scripts/python/netdev-times.py | 92 |
1 files changed, 48 insertions, 44 deletions
diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py index 9b2050f778f1..ea0c8b90a783 100644 --- a/tools/perf/scripts/python/netdev-times.py +++ b/tools/perf/scripts/python/netdev-times.py | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | # dev=: show only thing related to specified device | 8 | # dev=: show only thing related to specified device |
| 9 | # debug: work with debug mode. It shows buffer status. | 9 | # debug: work with debug mode. It shows buffer status. |
| 10 | 10 | ||
| 11 | from __future__ import print_function | ||
| 12 | |||
| 11 | import os | 13 | import os |
| 12 | import sys | 14 | import sys |
| 13 | 15 | ||
| @@ -17,6 +19,7 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | |||
| 17 | from perf_trace_context import * | 19 | from perf_trace_context import * |
| 18 | from Core import * | 20 | from Core import * |
| 19 | from Util import * | 21 | from Util import * |
| 22 | from functools import cmp_to_key | ||
| 20 | 23 | ||
| 21 | all_event_list = []; # insert all tracepoint event related with this script | 24 | all_event_list = []; # insert all tracepoint event related with this script |
| 22 | irq_dic = {}; # key is cpu and value is a list which stacks irqs | 25 | irq_dic = {}; # key is cpu and value is a list which stacks irqs |
| @@ -61,12 +64,12 @@ def diff_msec(src, dst): | |||
| 61 | def print_transmit(hunk): | 64 | def print_transmit(hunk): |
| 62 | if dev != 0 and hunk['dev'].find(dev) < 0: | 65 | if dev != 0 and hunk['dev'].find(dev) < 0: |
| 63 | return | 66 | return |
| 64 | print "%7s %5d %6d.%06dsec %12.3fmsec %12.3fmsec" % \ | 67 | print("%7s %5d %6d.%06dsec %12.3fmsec %12.3fmsec" % |
| 65 | (hunk['dev'], hunk['len'], | 68 | (hunk['dev'], hunk['len'], |
| 66 | nsecs_secs(hunk['queue_t']), | 69 | nsecs_secs(hunk['queue_t']), |
| 67 | nsecs_nsecs(hunk['queue_t'])/1000, | 70 | nsecs_nsecs(hunk['queue_t'])/1000, |
| 68 | diff_msec(hunk['queue_t'], hunk['xmit_t']), | 71 | diff_msec(hunk['queue_t'], hunk['xmit_t']), |
| 69 | diff_msec(hunk['xmit_t'], hunk['free_t'])) | 72 | diff_msec(hunk['xmit_t'], hunk['free_t']))) |
| 70 | 73 | ||
| 71 | # Format for displaying rx packet processing | 74 | # Format for displaying rx packet processing |
| 72 | PF_IRQ_ENTRY= " irq_entry(+%.3fmsec irq=%d:%s)" | 75 | PF_IRQ_ENTRY= " irq_entry(+%.3fmsec irq=%d:%s)" |
| @@ -98,55 +101,57 @@ def print_receive(hunk): | |||
| 98 | if show_hunk == 0: | 101 | if show_hunk == 0: |
| 99 | return | 102 | return |
| 100 | 103 | ||
| 101 | print "%d.%06dsec cpu=%d" % \ | 104 | print("%d.%06dsec cpu=%d" % |
| 102 | (nsecs_secs(base_t), nsecs_nsecs(base_t)/1000, cpu) | 105 | (nsecs_secs(base_t), nsecs_nsecs(base_t)/1000, cpu)) |
| 103 | for i in range(len(irq_list)): | 106 | for i in range(len(irq_list)): |
| 104 | print PF_IRQ_ENTRY % \ | 107 | print(PF_IRQ_ENTRY % |
| 105 | (diff_msec(base_t, irq_list[i]['irq_ent_t']), | 108 | (diff_msec(base_t, irq_list[i]['irq_ent_t']), |
| 106 | irq_list[i]['irq'], irq_list[i]['name']) | 109 | irq_list[i]['irq'], irq_list[i]['name'])) |
| 107 | print PF_JOINT | 110 | print(PF_JOINT) |
| 108 | irq_event_list = irq_list[i]['event_list'] | 111 | irq_event_list = irq_list[i]['event_list'] |
| 109 | for j in range(len(irq_event_list)): | 112 | for j in range(len(irq_event_list)): |
| 110 | irq_event = irq_event_list[j] | 113 | irq_event = irq_event_list[j] |
| 111 | if irq_event['event'] == 'netif_rx': | 114 | if irq_event['event'] == 'netif_rx': |
| 112 | print PF_NET_RX % \ | 115 | print(PF_NET_RX % |
| 113 | (diff_msec(base_t, irq_event['time']), | 116 | (diff_msec(base_t, irq_event['time']), |
| 114 | irq_event['skbaddr']) | 117 | irq_event['skbaddr'])) |
| 115 | print PF_JOINT | 118 | print(PF_JOINT) |
| 116 | print PF_SOFT_ENTRY % \ | 119 | print(PF_SOFT_ENTRY % |
| 117 | diff_msec(base_t, hunk['sirq_ent_t']) | 120 | diff_msec(base_t, hunk['sirq_ent_t'])) |
| 118 | print PF_JOINT | 121 | print(PF_JOINT) |
| 119 | event_list = hunk['event_list'] | 122 | event_list = hunk['event_list'] |
| 120 | for i in range(len(event_list)): | 123 | for i in range(len(event_list)): |
| 121 | event = event_list[i] | 124 | event = event_list[i] |
| 122 | if event['event_name'] == 'napi_poll': | 125 | if event['event_name'] == 'napi_poll': |
| 123 | print PF_NAPI_POLL % \ | 126 | print(PF_NAPI_POLL % |
| 124 | (diff_msec(base_t, event['event_t']), event['dev']) | 127 | (diff_msec(base_t, event['event_t']), |
| 128 | event['dev'])) | ||
| 125 | if i == len(event_list) - 1: | 129 | if i == len(event_list) - 1: |
| 126 | print "" | 130 | print("") |
| 127 | else: | 131 | else: |
| 128 | print PF_JOINT | 132 | print(PF_JOINT) |
| 129 | else: | 133 | else: |
| 130 | print PF_NET_RECV % \ | 134 | print(PF_NET_RECV % |
| 131 | (diff_msec(base_t, event['event_t']), event['skbaddr'], | 135 | (diff_msec(base_t, event['event_t']), |
| 132 | event['len']) | 136 | event['skbaddr'], |
| 137 | event['len'])) | ||
| 133 | if 'comm' in event.keys(): | 138 | if 'comm' in event.keys(): |
| 134 | print PF_WJOINT | 139 | print(PF_WJOINT) |
| 135 | print PF_CPY_DGRAM % \ | 140 | print(PF_CPY_DGRAM % |
| 136 | (diff_msec(base_t, event['comm_t']), | 141 | (diff_msec(base_t, event['comm_t']), |
| 137 | event['pid'], event['comm']) | 142 | event['pid'], event['comm'])) |
| 138 | elif 'handle' in event.keys(): | 143 | elif 'handle' in event.keys(): |
| 139 | print PF_WJOINT | 144 | print(PF_WJOINT) |
| 140 | if event['handle'] == "kfree_skb": | 145 | if event['handle'] == "kfree_skb": |
| 141 | print PF_KFREE_SKB % \ | 146 | print(PF_KFREE_SKB % |
| 142 | (diff_msec(base_t, | 147 | (diff_msec(base_t, |
| 143 | event['comm_t']), | 148 | event['comm_t']), |
| 144 | event['location']) | 149 | event['location'])) |
| 145 | elif event['handle'] == "consume_skb": | 150 | elif event['handle'] == "consume_skb": |
| 146 | print PF_CONS_SKB % \ | 151 | print(PF_CONS_SKB % |
| 147 | diff_msec(base_t, | 152 | diff_msec(base_t, |
| 148 | event['comm_t']) | 153 | event['comm_t'])) |
| 149 | print PF_JOINT | 154 | print(PF_JOINT) |
| 150 | 155 | ||
| 151 | def trace_begin(): | 156 | def trace_begin(): |
| 152 | global show_tx | 157 | global show_tx |
| @@ -172,8 +177,7 @@ def trace_begin(): | |||
| 172 | 177 | ||
| 173 | def trace_end(): | 178 | def trace_end(): |
| 174 | # order all events in time | 179 | # order all events in time |
| 175 | all_event_list.sort(lambda a,b :cmp(a[EINFO_IDX_TIME], | 180 | all_event_list.sort(key=cmp_to_key(lambda a,b :a[EINFO_IDX_TIME] < b[EINFO_IDX_TIME])) |
| 176 | b[EINFO_IDX_TIME])) | ||
| 177 | # process all events | 181 | # process all events |
| 178 | for i in range(len(all_event_list)): | 182 | for i in range(len(all_event_list)): |
| 179 | event_info = all_event_list[i] | 183 | event_info = all_event_list[i] |
| @@ -210,19 +214,19 @@ def trace_end(): | |||
| 210 | print_receive(receive_hunk_list[i]) | 214 | print_receive(receive_hunk_list[i]) |
| 211 | # display transmit hunks | 215 | # display transmit hunks |
| 212 | if show_tx: | 216 | if show_tx: |
| 213 | print " dev len Qdisc " \ | 217 | print(" dev len Qdisc " |
| 214 | " netdevice free" | 218 | " netdevice free") |
| 215 | for i in range(len(tx_free_list)): | 219 | for i in range(len(tx_free_list)): |
| 216 | print_transmit(tx_free_list[i]) | 220 | print_transmit(tx_free_list[i]) |
| 217 | if debug: | 221 | if debug: |
| 218 | print "debug buffer status" | 222 | print("debug buffer status") |
| 219 | print "----------------------------" | 223 | print("----------------------------") |
| 220 | print "xmit Qdisc:remain:%d overflow:%d" % \ | 224 | print("xmit Qdisc:remain:%d overflow:%d" % |
| 221 | (len(tx_queue_list), of_count_tx_queue_list) | 225 | (len(tx_queue_list), of_count_tx_queue_list)) |
| 222 | print "xmit netdevice:remain:%d overflow:%d" % \ | 226 | print("xmit netdevice:remain:%d overflow:%d" % |
| 223 | (len(tx_xmit_list), of_count_tx_xmit_list) | 227 | (len(tx_xmit_list), of_count_tx_xmit_list)) |
| 224 | print "receive:remain:%d overflow:%d" % \ | 228 | print("receive:remain:%d overflow:%d" % |
| 225 | (len(rx_skb_list), of_count_rx_skb_list) | 229 | (len(rx_skb_list), of_count_rx_skb_list)) |
| 226 | 230 | ||
| 227 | # called from perf, when it finds a correspoinding event | 231 | # called from perf, when it finds a correspoinding event |
| 228 | def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, callchain, vec): | 232 | def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, callchain, vec): |
| @@ -254,7 +258,7 @@ def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, callchain, i | |||
| 254 | all_event_list.append(event_info) | 258 | all_event_list.append(event_info) |
| 255 | 259 | ||
| 256 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi, | 260 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi, |
| 257 | dev_name, work=None, budget=None): | 261 | dev_name, work=None, budget=None): |
| 258 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 262 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
| 259 | napi, dev_name, work, budget) | 263 | napi, dev_name, work, budget) |
| 260 | all_event_list.append(event_info) | 264 | all_event_list.append(event_info) |
| @@ -351,7 +355,7 @@ def handle_irq_softirq_exit(event_info): | |||
| 351 | if irq_list == [] or event_list == 0: | 355 | if irq_list == [] or event_list == 0: |
| 352 | return | 356 | return |
| 353 | rec_data = {'sirq_ent_t':sirq_ent_t, 'sirq_ext_t':time, | 357 | rec_data = {'sirq_ent_t':sirq_ent_t, 'sirq_ext_t':time, |
| 354 | 'irq_list':irq_list, 'event_list':event_list} | 358 | 'irq_list':irq_list, 'event_list':event_list} |
| 355 | # merge information realted to a NET_RX softirq | 359 | # merge information realted to a NET_RX softirq |
| 356 | receive_hunk_list.append(rec_data) | 360 | receive_hunk_list.append(rec_data) |
| 357 | 361 | ||
| @@ -388,7 +392,7 @@ def handle_netif_receive_skb(event_info): | |||
| 388 | skbaddr, skblen, dev_name) = event_info | 392 | skbaddr, skblen, dev_name) = event_info |
| 389 | if cpu in net_rx_dic.keys(): | 393 | if cpu in net_rx_dic.keys(): |
| 390 | rec_data = {'event_name':'netif_receive_skb', | 394 | rec_data = {'event_name':'netif_receive_skb', |
| 391 | 'event_t':time, 'skbaddr':skbaddr, 'len':skblen} | 395 | 'event_t':time, 'skbaddr':skbaddr, 'len':skblen} |
| 392 | event_list = net_rx_dic[cpu]['event_list'] | 396 | event_list = net_rx_dic[cpu]['event_list'] |
| 393 | event_list.append(rec_data) | 397 | event_list.append(rec_data) |
| 394 | rx_skb_list.insert(0, rec_data) | 398 | rx_skb_list.insert(0, rec_data) |
