Skip to content

Commit

Permalink
Fix python3 incompatibilities
Browse files Browse the repository at this point in the history
Syntax and dict usages fixups in dcstat.py and memleak.py

Fixes: iovisor#433, iovisor#434
Signed-off-by: Brenden Blanco <[email protected]>
  • Loading branch information
Brenden Blanco committed Mar 11, 2016
1 parent 4ee0b76 commit c94ab7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/dcstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def usage():

# 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%")

Expand All @@ -123,7 +123,7 @@ def usage():
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="")
Expand Down
2 changes: 1 addition & 1 deletion tools/memleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c94ab7a

Please sign in to comment.