Commit 5467ccf4 authored by Brenden Blanco's avatar Brenden Blanco Committed by GitHub

Merge pull request #959 from r4f4/fix-uobjnew

Fix uobjnew and ustat on python3
parents 77d5273e 573a5d4e
...@@ -128,7 +128,7 @@ class USDT(object): ...@@ -128,7 +128,7 @@ class USDT(object):
probe) probe)
def get_text(self): 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): def get_probe_arg_ctype(self, probe_name, arg_index):
return lib.bcc_usdt_get_probe_argctype( return lib.bcc_usdt_get_probe_argctype(
......
...@@ -147,13 +147,13 @@ while True: ...@@ -147,13 +147,13 @@ while True:
print() print()
data = bpf["allocs"] data = bpf["allocs"]
if args.top_count: 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:] data = data[-args.top_count:]
elif args.top_size: 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:] data = data[-args.top_size:]
else: 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")) print("%-30s %8s %12s" % ("TYPE", "# ALLOCS", "# BYTES"))
for key, value in data: for key, value in data:
if args.language == "c": if args.language == "c":
......
...@@ -239,10 +239,10 @@ class Tool(object): ...@@ -239,10 +239,10 @@ class Tool(object):
counts.update(probe.get_counts(self.bpf)) counts.update(probe.get_counts(self.bpf))
targets.update(probe.targets) targets.update(probe.targets)
if self.args.sort: 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)) -v.get(self.args.sort.upper(), 0))
else: else:
counts = sorted(counts.items(), key=lambda (k, _): k) counts = sorted(counts.items(), key=lambda k, _: k)
for pid, stats in counts: for pid, stats in counts:
print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % ( print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % (
pid, targets[pid][:20], pid, targets[pid][:20],
......
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