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
a789867d
Commit
a789867d
authored
Sep 04, 2015
by
Brenden Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #182 from brendangregg/master
simplify code using new features
parents
e79676a7
d21af64c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
29 deletions
+4
-29
examples/disksnoop.py
examples/disksnoop.py
+0
-8
tools/syncsnoop
tools/syncsnoop
+3
-18
tools/vfscount
tools/vfscount
+1
-3
No files found.
examples/disksnoop.py
View file @
a789867d
...
...
@@ -12,7 +12,6 @@
from
__future__
import
print_function
from
bcc
import
BPF
import
sys
REQ_WRITE
=
1
# from include/linux/blk_types.h
...
...
@@ -24,13 +23,6 @@ b.attach_kprobe(event="blk_update_request", fn_name="do_completion")
# header
print
(
"%-18s %-2s %-7s %8s"
%
(
"TIME(s)"
,
"T"
,
"BYTES"
,
"LAT(ms)"
))
# open trace pipe
try
:
trace
=
open
(
"/sys/kernel/debug/tracing/trace_pipe"
,
"r"
)
except
:
print
(
"ERROR: opening trace_pipe"
,
file
=
sys
.
stderr
)
exit
(
1
)
# format output
while
1
:
(
task
,
pid
,
cpu
,
flags
,
ts
,
msg
)
=
b
.
trace_readline_fields
()
...
...
tools/syncsnoop
View file @
a789867d
...
...
@@ -13,7 +13,6 @@
from
__future__
import
print_function
from
bcc
import
BPF
import
sys
# load BPF program
b
=
BPF
(
text
=
"""
...
...
@@ -22,26 +21,12 @@ int do_sync(void *ctx) {
return 0;
};
"""
)
b
.
attach_kprobe
(
event
=
"sys_sync"
)
b
.
attach_kprobe
(
event
=
"sys_sync"
,
fn_name
=
"do_sync"
)
# header
print
(
"%-18s %s"
%
(
"TIME(s)"
,
"CALL"
))
# open trace pipe
try
:
trace
=
open
(
"/sys/kernel/debug/tracing/trace_pipe"
,
"r"
)
except
:
print
(
"ERROR: opening trace_pipe"
,
file
=
sys
.
stderr
)
exit
(
1
)
# format output
while
1
:
try
:
line
=
trace
.
readline
().
rstrip
()
except
KeyboardInterrupt
:
pass
;
exit
()
prolog
,
time_s
,
colon
,
word
=
line
.
rsplit
(
" "
,
3
)
time_s
=
time_s
[:
-
1
]
# strip trailing ":"
print
(
"%-18s %s"
%
(
time_s
,
word
))
(
task
,
pid
,
cpu
,
flags
,
ts
,
msg
)
=
b
.
trace_readline_fields
()
print
(
"%-18.9f %s"
%
(
ts
,
msg
))
tools/vfscount
View file @
a789867d
...
...
@@ -12,9 +12,7 @@
from
__future__
import
print_function
from
bcc
import
BPF
from
ctypes
import
c_ushort
,
c_int
,
c_ulonglong
from
time
import
sleep
,
strftime
from
sys
import
stderr
from
time
import
sleep
# load BPF program
b
=
BPF
(
src_file
=
"vfscount.c"
)
...
...
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