Skip to content

Commit

Permalink
ucalls: fix map behaviour on python3
Browse files Browse the repository at this point in the history
On python3 map returns a generator instead of a list. This fixes the
following error:

Traceback (most recent call last):
  File "./ucalls", line 280, in <module>
    data = get_data()   # [(function, (num calls, latency in ns))]
  File "./ucalls", line 255, in get_data
    data.extend(syscalls)
AttributeError: 'map' object has no attribute 'extend'
  • Loading branch information
r4f4 committed Feb 13, 2017
1 parent 5467ccf commit 42900ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/ucalls.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@
def get_data():
# Will be empty when no language was specified for tracing
if args.latency:
data = map(lambda (k, v): (k.clazz + "." + k.method,
data = list(map(lambda (k, v): (k.clazz + "." + k.method,
(v.num_calls, v.total_ns)),
bpf["times"].items())
bpf["times"].items()))
else:
data = map(lambda (k, v): (k.clazz + "." + k.method, (v.value, 0)),
bpf["counts"].items())
data = list(map(lambda (k, v): (k.clazz + "." + k.method, (v.value, 0)),
bpf["counts"].items()))

if args.syscalls:
if args.latency:
Expand Down

0 comments on commit 42900ae

Please sign in to comment.