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
1eee853c
Commit
1eee853c
authored
Dec 20, 2017
by
yonghong-song
Committed by
GitHub
Dec 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1497 from palmtenor/fix_python
Fix incorrect lost_cb type in Python
parents
25be6bb4
adb31b57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
src/python/bcc/table.py
src/python/bcc/table.py
+1
-1
tests/python/test_array.py
tests/python/test_array.py
+8
-2
No files found.
src/python/bcc/table.py
View file @
1eee853c
...
...
@@ -532,7 +532,7 @@ class PerfEventArray(ArrayBase):
exit
()
else
:
raise
e
def
lost_cb_
(
lost
):
def
lost_cb_
(
_
,
lost
):
try
:
lost_cb
(
lost
)
except
IOError
as
e
:
...
...
tests/python/test_array.py
View file @
1eee853c
...
...
@@ -49,6 +49,9 @@ class TestArray(TestCase):
event
=
ct
.
cast
(
data
,
ct
.
POINTER
(
Data
)).
contents
self
.
counter
+=
1
def
lost_cb
(
lost
):
self
.
assertGreater
(
lost
,
0
)
text
=
"""
BPF_PERF_OUTPUT(events);
int kprobe__sys_nanosleep(void *ctx) {
...
...
@@ -60,7 +63,7 @@ int kprobe__sys_nanosleep(void *ctx) {
}
"""
b
=
BPF
(
text
=
text
)
b
[
"events"
].
open_perf_buffer
(
cb
)
b
[
"events"
].
open_perf_buffer
(
cb
,
lost_cb
=
lost_cb
)
time
.
sleep
(
0.1
)
b
.
kprobe_poll
()
self
.
assertGreater
(
self
.
counter
,
0
)
...
...
@@ -77,6 +80,9 @@ int kprobe__sys_nanosleep(void *ctx) {
event
=
ct
.
cast
(
data
,
ct
.
POINTER
(
Data
)).
contents
self
.
events
.
append
(
event
)
def
lost_cb
(
lost
):
self
.
assertGreater
(
lost
,
0
)
text
=
"""
BPF_PERF_OUTPUT(events);
int kprobe__sys_nanosleep(void *ctx) {
...
...
@@ -88,7 +94,7 @@ int kprobe__sys_nanosleep(void *ctx) {
}
"""
b
=
BPF
(
text
=
text
)
b
[
"events"
].
open_perf_buffer
(
cb
)
b
[
"events"
].
open_perf_buffer
(
cb
,
lost_cb
=
lost_cb
)
online_cpus
=
get_online_cpus
()
for
cpu
in
online_cpus
:
subprocess
.
call
([
'taskset'
,
'-c'
,
str
(
cpu
),
'sleep'
,
'0.1'
])
...
...
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