examples/tracing: Use printb to improve python3 compatibility
When using python3, 'print' will output the bytes arrays with the "b"
prefix. Switch to printb to get rid of the prefix.
Signed-off-by: Gary Lin <glin@suse.com>
diff --git a/examples/tracing/urandomread.py b/examples/tracing/urandomread.py
index 319db2c..c1468c8 100755
--- a/examples/tracing/urandomread.py
+++ b/examples/tracing/urandomread.py
@@ -13,6 +13,7 @@
from __future__ import print_function
from bcc import BPF
+from bcc.utils import printb
# load BPF program
b = BPF(text="""
@@ -32,4 +33,4 @@
(task, pid, cpu, flags, ts, msg) = b.trace_fields()
except ValueError:
continue
- print("%-18.9f %-16s %-6d %s" % (ts, task, pid, msg))
+ printb(b"%-18.9f %-16s %-6d %s" % (ts, task, pid, msg))