Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
4135be22
Commit
4135be22
authored
9 years ago
by
4ast
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #183 from iovisor/bblanco_dev
Shorten trace_readline_fields to trace_fields
parents
a789867d
819334ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
examples/disksnoop.py
examples/disksnoop.py
+1
-1
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+4
-4
tools/syncsnoop
tools/syncsnoop
+1
-1
No files found.
examples/disksnoop.py
View file @
4135be22
...
@@ -25,7 +25,7 @@ print("%-18s %-2s %-7s %8s" % ("TIME(s)", "T", "BYTES", "LAT(ms)"))
...
@@ -25,7 +25,7 @@ print("%-18s %-2s %-7s %8s" % ("TIME(s)", "T", "BYTES", "LAT(ms)"))
# format output
# format output
while
1
:
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
()
(
bytes_s
,
bflags_s
,
us_s
)
=
msg
.
split
()
if
int
(
bflags_s
,
16
)
&
REQ_WRITE
:
if
int
(
bflags_s
,
16
)
&
REQ_WRITE
:
...
...
This diff is collapsed.
Click to expand it.
src/python/bcc/__init__.py
View file @
4135be22
...
@@ -492,8 +492,8 @@ class BPF(object):
...
@@ -492,8 +492,8 @@ class BPF(object):
return
tracefile
return
tracefile
@
staticmethod
@
staticmethod
def
trace_
readline_
fields
(
nonblocking
=
False
):
def
trace_fields
(
nonblocking
=
False
):
"""trace_
readline_
fields(nonblocking=False)
"""trace_fields(nonblocking=False)
Read from the kernel debug trace pipe and return a tuple of the
Read from the kernel debug trace pipe and return a tuple of the
fields (task, pid, cpu, flags, timestamp, msg) or None if no
fields (task, pid, cpu, flags, timestamp, msg) or None if no
...
@@ -537,13 +537,13 @@ class BPF(object):
...
@@ -537,13 +537,13 @@ class BPF(object):
Read from the kernel debug trace pipe and print on stdout.
Read from the kernel debug trace pipe and print on stdout.
If fmt is specified, apply as a format string to the output. See
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}")
example: trace_print(fmt="pid {1}, msg = {5}")
"""
"""
while
True
:
while
True
:
if
fmt
:
if
fmt
:
fields
=
BPF
.
trace_
readline_
fields
(
nonblocking
=
False
)
fields
=
BPF
.
trace_fields
(
nonblocking
=
False
)
if
not
fields
:
continue
if
not
fields
:
continue
line
=
fmt
.
format
(
*
fields
)
line
=
fmt
.
format
(
*
fields
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
tools/syncsnoop
View file @
4135be22
...
@@ -28,5 +28,5 @@ print("%-18s %s" % ("TIME(s)", "CALL"))
...
@@ -28,5 +28,5 @@ print("%-18s %s" % ("TIME(s)", "CALL"))
# format output
# format output
while
1
:
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
))
print
(
"%-18.9f %s"
%
(
ts
,
msg
))
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment