bcc/bcc-0.7.0-uflow-str-bytes.patch
Rafael dos Santos 2d10bad522 Resolves #1636293 - convert bytes to str in uflow
Signed-off-by: Rafael dos Santos <rdossant@redhat.com>
2018-10-06 09:05:15 +02:00

66 lines
2.2 KiB
Diff

From 215fc84bac0037ac5b2047940f97ecc97f0860b9 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Fri, 5 Oct 2018 16:47:29 +0300
Subject: [PATCH 1/2] uflow: convert bytes to str
Python 3 fix, similar to commit 99d1468 and commit 4e4c9e0 for ucalls.
Closes #1996.
---
tools/lib/uflow.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/lib/uflow.py b/tools/lib/uflow.py
index fb306e31d..fdbcfc332 100755
--- a/tools/lib/uflow.py
+++ b/tools/lib/uflow.py
@@ -196,7 +196,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:
From 1c7e2a8f3fb02d4516fccc410272324fff250be9 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Fri, 5 Oct 2018 17:16:13 +0300
Subject: [PATCH 2/2] uflow: drop unused timestamp field
---
tools/lib/uflow.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/lib/uflow.py b/tools/lib/uflow.py
index fdbcfc332..f2a458d7b 100755
--- a/tools/lib/uflow.py
+++ b/tools/lib/uflow.py
@@ -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];
};
@@ -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
@@ -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)
]