Resolves #1636293 - convert bytes to str in uflow

Signed-off-by: Rafael dos Santos <rdossant@redhat.com>
This commit is contained in:
Rafael dos Santos 2018-10-06 09:05:15 +02:00
parent 29228430fc
commit 2d10bad522
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,65 @@
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)
]

View File

@ -9,12 +9,15 @@
Name: bcc
Version: 0.7.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: BPF Compiler Collection (BCC)
License: ASL 2.0
URL: https://github.com/iovisor/bcc
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# https://bugzilla.redhat.com/show_bug.cgi?id=1636293
Patch0: %{name}-%{version}-uflow-str-bytes.patch
# Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches
ExclusiveArch: x86_64 %{power64}
@ -165,6 +168,9 @@ mv %{buildroot}%{_datadir}/%{name}/examples %{buildroot}%{_docdir}/%{name}/
%changelog
* Sat Oct 06 2018 Rafael dos Santos <rdossant@redhat.com> - 0.7.0-2
- Fix str/bytes conversion in uflow (#1636293)
* Tue Sep 25 2018 Rafael Fonseca <r4f4rfs@gmail.com> - 0.7.0-1
- Rebase to new released version