Skip to content

Commit

Permalink
Merge pull request iovisor#959 from r4f4/fix-uobjnew
Browse files Browse the repository at this point in the history
Fix uobjnew and ustat on python3
  • Loading branch information
drzaeus77 committed Feb 10, 2017
2 parents 77d5273 + 573a5d4 commit 5467ccf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/python/bcc/usdt.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def enable_probe(self, probe, fn_name):
probe)

def get_text(self):
return lib.bcc_usdt_genargs(self.context)
return lib.bcc_usdt_genargs(self.context).decode()

def get_probe_arg_ctype(self, probe_name, arg_index):
return lib.bcc_usdt_get_probe_argctype(
Expand Down
6 changes: 3 additions & 3 deletions tools/uobjnew.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@
print()
data = bpf["allocs"]
if args.top_count:
data = sorted(data.items(), key=lambda (k, v): v.num_allocs)
data = sorted(data.items(), key=lambda k, v: v.num_allocs)
data = data[-args.top_count:]
elif args.top_size:
data = sorted(data.items(), key=lambda (k, v): v.total_size)
data = sorted(data.items(), key=lambda k, v: v.total_size)
data = data[-args.top_size:]
else:
data = sorted(data.items(), key=lambda (k, v): v.total_size)
data = sorted(data.items(), key=lambda k, v: v.total_size)
print("%-30s %8s %12s" % ("TYPE", "# ALLOCS", "# BYTES"))
for key, value in data:
if args.language == "c":
Expand Down
4 changes: 2 additions & 2 deletions tools/ustat.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ def _loop_iter(self):
counts.update(probe.get_counts(self.bpf))
targets.update(probe.targets)
if self.args.sort:
counts = sorted(counts.items(), key=lambda (_, v):
counts = sorted(counts.items(), key=lambda _, v:
-v.get(self.args.sort.upper(), 0))
else:
counts = sorted(counts.items(), key=lambda (k, _): k)
counts = sorted(counts.items(), key=lambda k, _: k)
for pid, stats in counts:
print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % (
pid, targets[pid][:20],
Expand Down

0 comments on commit 5467ccf

Please sign in to comment.