Skip to content

Commit b504d7f

Browse files
tonyj-suseacmel
authored andcommitted
perf script python: Remove mixed indentation
Remove mixed indentation in Python scripts. Revert to either all tabs (most common form) or all spaces (4 or 8) depending on what was the intent of the original commit. This is necessary to complete Python3 support as it will flag an error if it encounters mixed indentation. Signed-off-by: Tony Jones <tonyj@suse.de> Link: http://lkml.kernel.org/r/20190302011903.2416-2-tonyj@suse.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent c1d3e63 commit b504d7f

14 files changed

Lines changed: 136 additions & 135 deletions

‎tools/perf/scripts/python/check-perf-trace.py‎

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,59 @@ def trace_begin():
2323
pass
2424

2525
def trace_end():
26-
print_unhandled()
26+
print_unhandled()
2727

2828
def irq__softirq_entry(event_name, context, common_cpu,
29-
common_secs, common_nsecs, common_pid, common_comm,
30-
common_callchain, vec):
31-
print_header(event_name, common_cpu, common_secs, common_nsecs,
32-
common_pid, common_comm)
29+
common_secs, common_nsecs, common_pid, common_comm,
30+
common_callchain, vec):
31+
print_header(event_name, common_cpu, common_secs, common_nsecs,
32+
common_pid, common_comm)
3333

34-
print_uncommon(context)
34+
print_uncommon(context)
3535

36-
print "vec=%s\n" % \
37-
(symbol_str("irq__softirq_entry", "vec", vec)),
36+
print "vec=%s\n" % (symbol_str("irq__softirq_entry", "vec", vec)),
3837

3938
def kmem__kmalloc(event_name, context, common_cpu,
40-
common_secs, common_nsecs, common_pid, common_comm,
41-
common_callchain, call_site, ptr, bytes_req, bytes_alloc,
42-
gfp_flags):
43-
print_header(event_name, common_cpu, common_secs, common_nsecs,
44-
common_pid, common_comm)
39+
common_secs, common_nsecs, common_pid, common_comm,
40+
common_callchain, call_site, ptr, bytes_req, bytes_alloc,
41+
gfp_flags):
42+
print_header(event_name, common_cpu, common_secs, common_nsecs,
43+
common_pid, common_comm)
4544

46-
print_uncommon(context)
45+
print_uncommon(context)
4746

48-
print "call_site=%u, ptr=%u, bytes_req=%u, " \
47+
print "call_site=%u, ptr=%u, bytes_req=%u, " \
4948
"bytes_alloc=%u, gfp_flags=%s\n" % \
5049
(call_site, ptr, bytes_req, bytes_alloc,
51-
5250
flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
5351

5452
def trace_unhandled(event_name, context, event_fields_dict):
55-
try:
56-
unhandled[event_name] += 1
57-
except TypeError:
58-
unhandled[event_name] = 1
53+
try:
54+
unhandled[event_name] += 1
55+
except TypeError:
56+
unhandled[event_name] = 1
5957

6058
def print_header(event_name, cpu, secs, nsecs, pid, comm):
6159
print "%-20s %5u %05u.%09u %8u %-20s " % \
62-
(event_name, cpu, secs, nsecs, pid, comm),
60+
(event_name, cpu, secs, nsecs, pid, comm),
6361

6462
# print trace fields not included in handler args
6563
def print_uncommon(context):
66-
print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
67-
% (common_pc(context), trace_flag_str(common_flags(context)), \
68-
common_lock_depth(context))
64+
print "common_preempt_count=%d, common_flags=%s, " \
65+
"common_lock_depth=%d, " % \
66+
(common_pc(context), trace_flag_str(common_flags(context)),
67+
common_lock_depth(context))
6968

7069
def print_unhandled():
71-
keys = unhandled.keys()
72-
if not keys:
73-
return
70+
keys = unhandled.keys()
71+
if not keys:
72+
return
7473

75-
print "\nunhandled events:\n\n",
74+
print "\nunhandled events:\n\n",
7675

77-
print "%-40s %10s\n" % ("event", "count"),
78-
print "%-40s %10s\n" % ("----------------------------------------", \
79-
"-----------"),
76+
print "%-40s %10s\n" % ("event", "count"),
77+
print "%-40s %10s\n" % ("----------------------------------------", \
78+
"-----------"),
8079

81-
for event_name in keys:
82-
print "%-40s %10d\n" % (event_name, unhandled[event_name])
80+
for event_name in keys:
81+
print "%-40s %10d\n" % (event_name, unhandled[event_name])

‎tools/perf/scripts/python/compaction-times.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ def compaction__mm_compaction_migratepages(event_name, context, common_cpu,
216216
pair(nr_migrated, nr_failed), None, None)
217217

218218
def compaction__mm_compaction_isolate_freepages(event_name, context, common_cpu,
219-
common_secs, common_nsecs, common_pid, common_comm,
220-
common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
219+
common_secs, common_nsecs, common_pid, common_comm,
220+
common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
221221

222222
chead.increment_pending(common_pid,
223223
None, pair(nr_scanned, nr_taken), None)
224224

225225
def compaction__mm_compaction_isolate_migratepages(event_name, context, common_cpu,
226-
common_secs, common_nsecs, common_pid, common_comm,
227-
common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
226+
common_secs, common_nsecs, common_pid, common_comm,
227+
common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
228228

229229
chead.increment_pending(common_pid,
230230
None, None, pair(nr_scanned, nr_taken))

‎tools/perf/scripts/python/event_analyzing_sample.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
con.isolation_level = None
3838

3939
def trace_begin():
40-
print "In trace_begin:\n"
40+
print "In trace_begin:\n"
4141

4242
#
4343
# Will create several tables at the start, pebs_ll is for PEBS data with
@@ -102,7 +102,7 @@ def insert_db(event):
102102
event.ip, event.status, event.dse, event.dla, event.lat))
103103

104104
def trace_end():
105-
print "In trace_end:\n"
105+
print "In trace_end:\n"
106106
# We show the basic info for the 2 type of event classes
107107
show_general_events()
108108
show_pebs_ll()
@@ -187,4 +187,4 @@ def show_pebs_ll():
187187
print "%32s %8d %s" % (row[0], row[1], num2sym(row[1]))
188188

189189
def trace_unhandled(event_name, context, event_fields_dict):
190-
print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
190+
print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])

‎tools/perf/scripts/python/failed-syscalls-by-pid.py‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ def syscalls__sys_exit(event_name, context, common_cpu,
5858
raw_syscalls__sys_exit(**locals())
5959

6060
def print_error_totals():
61-
if for_comm is not None:
62-
print("\nsyscall errors for %s:\n" % (for_comm))
63-
else:
64-
print("\nsyscall errors:\n")
65-
66-
print("%-30s %10s" % ("comm [pid]", "count"))
67-
print("%-30s %10s" % ("------------------------------", "----------"))
68-
69-
comm_keys = syscalls.keys()
70-
for comm in comm_keys:
71-
pid_keys = syscalls[comm].keys()
72-
for pid in pid_keys:
73-
print("\n%s [%d]" % (comm, pid))
74-
id_keys = syscalls[comm][pid].keys()
75-
for id in id_keys:
76-
print(" syscall: %-16s" % syscall_name(id))
77-
ret_keys = syscalls[comm][pid][id].keys()
78-
for ret, val in sorted(syscalls[comm][pid][id].items(), key = lambda kv: (kv[1], kv[0]), reverse = True):
79-
print(" err = %-20s %10d" % (strerror(ret), val))
61+
if for_comm is not None:
62+
print("\nsyscall errors for %s:\n" % (for_comm))
63+
else:
64+
print("\nsyscall errors:\n")
65+
66+
print("%-30s %10s" % ("comm [pid]", "count"))
67+
print("%-30s %10s" % ("------------------------------", "----------"))
68+
69+
comm_keys = syscalls.keys()
70+
for comm in comm_keys:
71+
pid_keys = syscalls[comm].keys()
72+
for pid in pid_keys:
73+
print("\n%s [%d]" % (comm, pid))
74+
id_keys = syscalls[comm][pid].keys()
75+
for id in id_keys:
76+
print(" syscall: %-16s" % syscall_name(id))
77+
ret_keys = syscalls[comm][pid][id].keys()
78+
for ret, val in sorted(syscalls[comm][pid][id].items(), key = lambda kv: (kv[1], kv[0]), reverse = True):
79+
print(" err = %-20s %10d" % (strerror(ret), val))

‎tools/perf/scripts/python/futex-contention.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ def trace_end():
4646
for (tid, lock) in lock_waits:
4747
min, max, avg, count = lock_waits[tid, lock]
4848
print "%s[%d] lock %x contended %d times, %d avg ns" % \
49-
(process_names[tid], tid, lock, count, avg)
49+
(process_names[tid], tid, lock, count, avg)
5050

‎tools/perf/scripts/python/intel-pt-events.py‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ def print_common_ip(sample, symbol, dso):
8585
print "%16x %s (%s)" % (ip, symbol, dso)
8686

8787
def process_event(param_dict):
88-
event_attr = param_dict["attr"]
89-
sample = param_dict["sample"]
90-
raw_buf = param_dict["raw_buf"]
91-
comm = param_dict["comm"]
92-
name = param_dict["ev_name"]
93-
94-
# Symbol and dso info are not always resolved
95-
if (param_dict.has_key("dso")):
96-
dso = param_dict["dso"]
97-
else:
98-
dso = "[unknown]"
99-
100-
if (param_dict.has_key("symbol")):
101-
symbol = param_dict["symbol"]
102-
else:
103-
symbol = "[unknown]"
88+
event_attr = param_dict["attr"]
89+
sample = param_dict["sample"]
90+
raw_buf = param_dict["raw_buf"]
91+
comm = param_dict["comm"]
92+
name = param_dict["ev_name"]
93+
94+
# Symbol and dso info are not always resolved
95+
if (param_dict.has_key("dso")):
96+
dso = param_dict["dso"]
97+
else:
98+
dso = "[unknown]"
99+
100+
if (param_dict.has_key("symbol")):
101+
symbol = param_dict["symbol"]
102+
else:
103+
symbol = "[unknown]"
104104

105105
if name == "ptwrite":
106106
print_common_start(comm, sample, name)

‎tools/perf/scripts/python/mem-phys-addr.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ def print_memory_type():
4444
print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage"), end='')
4545
print("%-40s %10s %10s\n" % ("----------------------------------------",
4646
"-----------", "-----------"),
47-
end='');
47+
end='');
4848
total = sum(load_mem_type_cnt.values())
4949
for mem_type, count in sorted(load_mem_type_cnt.most_common(), \
5050
key = lambda kv: (kv[1], kv[0]), reverse = True):
51-
print("%-40s %10d %10.1f%%\n" % (mem_type, count, 100 * count / total),
52-
end='')
51+
print("%-40s %10d %10.1f%%\n" %
52+
(mem_type, count, 100 * count / total),
53+
end='')
5354

5455
def trace_begin():
5556
parse_iomem()

‎tools/perf/scripts/python/net_dropmonitor.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88

99
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
10-
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
10+
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
1111

1212
from perf_trace_context import *
1313
from Core import *

‎tools/perf/scripts/python/netdev-times.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,16 @@ def print_receive(hunk):
124124
event = event_list[i]
125125
if event['event_name'] == 'napi_poll':
126126
print(PF_NAPI_POLL %
127-
(diff_msec(base_t, event['event_t']), event['dev']))
127+
(diff_msec(base_t, event['event_t']),
128+
event['dev']))
128129
if i == len(event_list) - 1:
129130
print("")
130131
else:
131132
print(PF_JOINT)
132133
else:
133134
print(PF_NET_RECV %
134-
(diff_msec(base_t, event['event_t']), event['skbaddr'],
135+
(diff_msec(base_t, event['event_t']),
136+
event['skbaddr'],
135137
event['len']))
136138
if 'comm' in event.keys():
137139
print(PF_WJOINT)
@@ -256,7 +258,7 @@ def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, callchain, i
256258
all_event_list.append(event_info)
257259

258260
def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi,
259-
dev_name, work=None, budget=None):
261+
dev_name, work=None, budget=None):
260262
event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
261263
napi, dev_name, work, budget)
262264
all_event_list.append(event_info)
@@ -353,7 +355,7 @@ def handle_irq_softirq_exit(event_info):
353355
if irq_list == [] or event_list == 0:
354356
return
355357
rec_data = {'sirq_ent_t':sirq_ent_t, 'sirq_ext_t':time,
356-
'irq_list':irq_list, 'event_list':event_list}
358+
'irq_list':irq_list, 'event_list':event_list}
357359
# merge information realted to a NET_RX softirq
358360
receive_hunk_list.append(rec_data)
359361

@@ -390,7 +392,7 @@ def handle_netif_receive_skb(event_info):
390392
skbaddr, skblen, dev_name) = event_info
391393
if cpu in net_rx_dic.keys():
392394
rec_data = {'event_name':'netif_receive_skb',
393-
'event_t':time, 'skbaddr':skbaddr, 'len':skblen}
395+
'event_t':time, 'skbaddr':skbaddr, 'len':skblen}
394396
event_list = net_rx_dic[cpu]['event_list']
395397
event_list.append(rec_data)
396398
rx_skb_list.insert(0, rec_data)

‎tools/perf/scripts/python/sched-migration.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from collections import defaultdict
1616
try:
17-
from UserList import UserList
17+
from UserList import UserList
1818
except ImportError:
19-
# Python 3: UserList moved to the collections package
20-
from collections import UserList
19+
# Python 3: UserList moved to the collections package
20+
from collections import UserList
2121

2222
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
2323
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')

0 commit comments

Comments
 (0)