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
efa6ee93
Commit
efa6ee93
authored
Dec 30, 2017
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BPF.tracepoint_exists()
parent
e023bc89
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+5
-0
tools/tcplife.py
tools/tcplife.py
+1
-4
No files found.
src/python/bcc/__init__.py
View file @
efa6ee93
...
...
@@ -644,6 +644,11 @@ class BPF(object):
results
.
append
(
tp
)
return
results
@
staticmethod
def
tracepoint_exists
(
category
,
event
):
evt_dir
=
os
.
path
.
join
(
TRACEFS
,
"events"
,
category
,
event
)
return
os
.
path
.
isdir
(
evt_dir
)
def
attach_tracepoint
(
self
,
tp
=
""
,
tp_re
=
""
,
fn_name
=
""
):
"""attach_tracepoint(tp="", tp_re="", fn_name="")
...
...
tools/tcplife.py
View file @
efa6ee93
...
...
@@ -28,9 +28,6 @@ from socket import inet_ntop, ntohs, AF_INET, AF_INET6
from
struct
import
pack
import
ctypes
as
ct
from
time
import
strftime
import
os
TRACEFS
=
"/sys/kernel/debug/tracing"
# arguments
examples
=
"""examples:
...
...
@@ -355,7 +352,7 @@ TRACEPOINT_PROBE(tcp, tcp_set_state)
}
"""
if
(
os
.
path
.
exists
(
TRACEFS
+
"/events/tcp/
tcp_set_state"
)):
if
(
BPF
.
tracepoint_exists
(
"tcp"
,
"
tcp_set_state"
)):
bpf_text
+=
bpf_text_tracepoint
else
:
bpf_text
+=
bpf_text_kprobe
...
...
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