Skip to content

Commit

Permalink
ucalls: convert bytes to str
Browse files Browse the repository at this point in the history
This fixes the following error with python3

Tracing calls in process 2577 (language: python)... Ctrl-C to quit.
^C
Traceback (most recent call last):
  File "/usr/share/bcc/tools/lib/ucalls", line 303, in <module>
    data = get_data()   # [(function, (num calls, latency in ns))]
  File "/usr/share/bcc/tools/lib/ucalls", line 264, in get_data
    bpf["counts"].items()))
  File "/usr/share/bcc/tools/lib/ucalls", line 262, in <lambda>
    data = list(map(lambda kv: (kv[0].clazz + "." + kv[0].method,
TypeError: can't concat str to bytes

Signed-off-by: Rafael Fonseca <[email protected]>
  • Loading branch information
r4f4 committed Dec 15, 2017
1 parent bebb9c8 commit 99d1468
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/lib/ucalls.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@
def get_data():
# Will be empty when no language was specified for tracing
if args.latency:
data = list(map(lambda kv: (kv[0].clazz + "." + kv[0].method,
data = list(map(lambda kv: (kv[0].clazz.decode() + "." + \
kv[0].method.decode(),
(kv[1].num_calls, kv[1].total_ns)),
bpf["times"].items()))
else:
data = list(map(lambda kv: (kv[0].clazz + "." + kv[0].method,
data = list(map(lambda kv: (kv[0].clazz.decode() + "." + \
kv[0].method.decode(),
(kv[1].value, 0)),
bpf["counts"].items()))

Expand Down

0 comments on commit 99d1468

Please sign in to comment.