Commit c94ab7a0 authored by Brenden Blanco's avatar Brenden Blanco

Fix python3 incompatibilities

Syntax and dict usages fixups in dcstat.py and memleak.py

Fixes: #433, #434
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 4ee0b76e
...@@ -103,7 +103,7 @@ stats = { ...@@ -103,7 +103,7 @@ stats = {
# header # header
print("%-8s " % "TIME", end="") 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" % (stype + "/s"), end="")
print(" %8s" % "HIT%") print(" %8s" % "HIT%")
...@@ -123,7 +123,7 @@ while (1): ...@@ -123,7 +123,7 @@ while (1):
print("%-8s: " % strftime("%H:%M:%S"), end="") print("%-8s: " % strftime("%H:%M:%S"), end="")
# print each statistic as a column # 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: try:
val = b["stats"][c_int(idx)].value / interval val = b["stats"][c_int(idx)].value / interval
print(" %8d" % val, end="") print(" %8d" % val, end="")
......
...@@ -385,7 +385,7 @@ def print_outstanding(): ...@@ -385,7 +385,7 @@ def print_outstanding():
count_so_far = 0 count_so_far = 0
while True: while True:
if trace_all: if trace_all:
print bpf_program.trace_fields() print(bpf_program.trace_fields())
else: else:
try: try:
sleep(interval) sleep(interval)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment