Skip to content

Commit

Permalink
Merge pull request iovisor#1997 from myllynen/fix-uflow-typeerror
Browse files Browse the repository at this point in the history
uflow: convert bytes to str
  • Loading branch information
palmtenor committed Oct 5, 2018
2 parents e55c68a + 1c7e2a8 commit 91be69a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/lib/uflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
struct call_t {
u64 depth; // first bit is direction (0 entry, 1 return)
u64 pid; // (tgid << 32) + pid from bpf_get_current...
u64 timestamp; // ns
char clazz[80];
char method[80];
};
Expand Down Expand Up @@ -89,7 +88,6 @@
FILTER_METHOD
data.pid = bpf_get_current_pid_tgid();
data.timestamp = bpf_ktime_get_ns();
depth = entry.lookup_or_init(&data.pid, &zero);
data.depth = DEPTH;
UPDATE
Expand Down Expand Up @@ -183,7 +181,6 @@ class CallEvent(ct.Structure):
_fields_ = [
("depth", ct.c_ulonglong),
("pid", ct.c_ulonglong),
("timestamp", ct.c_ulonglong),
("clazz", ct.c_char * 80),
("method", ct.c_char * 80)
]
Expand All @@ -196,7 +193,9 @@ def print_event(cpu, data, size):
direction = "<- " if event.depth & (1 << 63) else "-> "
print("%-3d %-6d %-6d %-8.3f %-40s" % (cpu, event.pid >> 32,
event.pid & 0xFFFFFFFF, time.time() - start_ts,
(" " * (depth - 1)) + direction + event.clazz + "." + event.method))
(" " * (depth - 1)) + direction + \
event.clazz.decode('utf-8', 'replace') + "." + \
event.method.decode('utf-8', 'replace')))

bpf["calls"].open_perf_buffer(print_event)
while 1:
Expand Down

0 comments on commit 91be69a

Please sign in to comment.