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
f8eb5453
Commit
f8eb5453
authored
Oct 14, 2015
by
SunKyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf_reader : add timeout argument to perf_reader_poll
parent
c9b920bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
src/cc/perf_reader.c
src/cc/perf_reader.c
+2
-2
src/cc/perf_reader.h
src/cc/perf_reader.h
+1
-1
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+3
-3
No files found.
src/cc/perf_reader.c
View file @
f8eb5453
...
...
@@ -205,11 +205,11 @@ static void event_read(struct perf_reader *reader) {
}
}
int
perf_reader_poll
(
int
num_readers
,
struct
perf_reader
**
readers
)
{
int
perf_reader_poll
(
int
num_readers
,
struct
perf_reader
**
readers
,
int
timeout
)
{
struct
pollfd
pfds
[]
=
{
{
readers
[
0
]
->
fd
,
POLLIN
},
};
if
(
poll
(
pfds
,
num_readers
,
-
1
)
>
0
)
{
if
(
poll
(
pfds
,
num_readers
,
timeout
)
>
0
)
{
int
i
;
for
(
i
=
0
;
i
<
num_readers
;
++
i
)
{
if
(
pfds
[
i
].
revents
&
POLLIN
)
...
...
src/cc/perf_reader.h
View file @
f8eb5453
...
...
@@ -19,4 +19,4 @@ struct perf_reader;
struct
perf_reader
*
perf_reader_new
(
int
fd
,
int
page_cnt
,
perf_reader_cb
cb
,
void
*
cb_cookie
);
void
perf_reader_free
(
void
*
ptr
);
int
perf_reader_mmap
(
struct
perf_reader
*
reader
,
int
fd
,
unsigned
long
sample_type
);
int
perf_reader_poll
(
int
num_readers
,
struct
perf_reader
**
readers
);
int
perf_reader_poll
(
int
num_readers
,
struct
perf_reader
**
readers
,
int
timeout
);
src/python/bcc/__init__.py
View file @
f8eb5453
...
...
@@ -94,7 +94,7 @@ lib.bpf_attach_kprobe.argtypes = [ct.c_int, ct.c_char_p, ct.c_char_p, ct.c_int,
lib
.
bpf_detach_kprobe
.
restype
=
ct
.
c_int
lib
.
bpf_detach_kprobe
.
argtypes
=
[
ct
.
c_char_p
]
lib
.
perf_reader_poll
.
restype
=
ct
.
c_int
lib
.
perf_reader_poll
.
argtypes
=
[
ct
.
c_int
,
ct
.
POINTER
(
ct
.
c_void_p
)]
lib
.
perf_reader_poll
.
argtypes
=
[
ct
.
c_int
,
ct
.
POINTER
(
ct
.
c_void_p
)
,
ct
.
c_int
]
lib
.
perf_reader_free
.
restype
=
None
lib
.
perf_reader_free
.
argtypes
=
[
ct
.
c_void_p
]
...
...
@@ -780,7 +780,7 @@ class BPF(object):
"""
return
len
(
open_kprobes
)
def
kprobe_poll
(
self
):
def
kprobe_poll
(
self
,
timeout
=
-
1
):
"""kprobe_poll(self)
Poll from the ring buffers for all of the open kprobes, calling the
...
...
@@ -790,7 +790,7 @@ class BPF(object):
for
i
,
v
in
enumerate
(
open_kprobes
.
values
()):
readers
[
i
]
=
v
try
:
lib
.
perf_reader_poll
(
len
(
open_kprobes
),
readers
)
lib
.
perf_reader_poll
(
len
(
open_kprobes
),
readers
,
timeout
)
except
KeyboardInterrupt
:
pass
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