From: Brenden Blanco Date: Fri, 11 Mar 2016 23:34:29 +0000 (-0800) Subject: Fix python3 incompatibilities X-Git-Tag: v0.2.0~144^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c94ab7a03608ab8cb4814d55e6fb4ce22e62d667;p=platform%2Fupstream%2Fbcc.git Fix python3 incompatibilities Syntax and dict usages fixups in dcstat.py and memleak.py Fixes: #433, #434 Signed-off-by: Brenden Blanco --- diff --git a/tools/dcstat.py b/tools/dcstat.py index b526a43..0da3967 100755 --- a/tools/dcstat.py +++ b/tools/dcstat.py @@ -103,7 +103,7 @@ stats = { # header print("%-8s " % "TIME", end="") -for stype, idx in sorted(stats.iteritems(), key=lambda (k, v): (v, k)): +for stype, idx in sorted(stats.items(), key=lambda k_v: (k_v[1], k_v[0])): print(" %8s" % (stype + "/s"), end="") print(" %8s" % "HIT%") @@ -123,7 +123,7 @@ while (1): print("%-8s: " % strftime("%H:%M:%S"), end="") # print each statistic as a column - for stype, idx in sorted(stats.iteritems(), key=lambda (k, v): (v, k)): + for stype, idx in sorted(stats.items(), key=lambda k_v: (k_v[1], k_v[0])): try: val = b["stats"][c_int(idx)].value / interval print(" %8d" % val, end="") diff --git a/tools/memleak.py b/tools/memleak.py index 7100050..b5f272d 100755 --- a/tools/memleak.py +++ b/tools/memleak.py @@ -385,7 +385,7 @@ def print_outstanding(): count_so_far = 0 while True: if trace_all: - print bpf_program.trace_fields() + print(bpf_program.trace_fields()) else: try: sleep(interval)