Shorten trace_readline_fields to trace_fields
* Per suggestion in #149
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
diff --git a/examples/disksnoop.py b/examples/disksnoop.py
index 6da269b..aa16141 100755
--- a/examples/disksnoop.py
+++ b/examples/disksnoop.py
@@ -25,7 +25,7 @@
# format output
while 1:
- (task, pid, cpu, flags, ts, msg) = b.trace_readline_fields()
+ (task, pid, cpu, flags, ts, msg) = b.trace_fields()
(bytes_s, bflags_s, us_s) = msg.split()
if int(bflags_s, 16) & REQ_WRITE:
diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
index e24020a..b11b94e 100644
--- a/src/python/bcc/__init__.py
+++ b/src/python/bcc/__init__.py
@@ -492,8 +492,8 @@
return tracefile
@staticmethod
- def trace_readline_fields(nonblocking=False):
- """trace_readline_fields(nonblocking=False)
+ def trace_fields(nonblocking=False):
+ """trace_fields(nonblocking=False)
Read from the kernel debug trace pipe and return a tuple of the
fields (task, pid, cpu, flags, timestamp, msg) or None if no
@@ -537,13 +537,13 @@
Read from the kernel debug trace pipe and print on stdout.
If fmt is specified, apply as a format string to the output. See
- trace_readline_fields for the members of the tuple
+ trace_fields for the members of the tuple
example: trace_print(fmt="pid {1}, msg = {5}")
"""
while True:
if fmt:
- fields = BPF.trace_readline_fields(nonblocking=False)
+ fields = BPF.trace_fields(nonblocking=False)
if not fields: continue
line = fmt.format(*fields)
else:
diff --git a/tools/syncsnoop b/tools/syncsnoop
index 4fce39a..fe24075 100755
--- a/tools/syncsnoop
+++ b/tools/syncsnoop
@@ -28,5 +28,5 @@
# format output
while 1:
- (task, pid, cpu, flags, ts, msg) = b.trace_readline_fields()
+ (task, pid, cpu, flags, ts, msg) = b.trace_fields()
print("%-18.9f %s" % (ts, msg))