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
fbbe6d6e
Commit
fbbe6d6e
authored
Oct 25, 2017
by
4ast
Committed by
GitHub
Oct 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1393 from pchaigno/handle-epipe
Exit on EPIPE
parents
1e7dc399
860dbb08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
src/python/bcc/table.py
src/python/bcc/table.py
+19
-2
No files found.
src/python/bcc/table.py
View file @
fbbe6d6e
...
...
@@ -17,6 +17,7 @@ import ctypes as ct
from
functools
import
reduce
import
multiprocessing
import
os
import
errno
from
.libbcc
import
lib
,
_RAW_CB_TYPE
,
_LOST_CB_TYPE
from
.perf
import
Perf
...
...
@@ -523,8 +524,24 @@ class PerfEventArray(ArrayBase):
self
.
_open_perf_buffer
(
i
,
callback
,
page_cnt
,
lost_cb
)
def
_open_perf_buffer
(
self
,
cpu
,
callback
,
page_cnt
,
lost_cb
):
fn
=
_RAW_CB_TYPE
(
lambda
_
,
data
,
size
:
callback
(
cpu
,
data
,
size
))
lost_fn
=
_LOST_CB_TYPE
(
lambda
lost
:
lost_cb
(
lost
))
if
lost_cb
else
ct
.
cast
(
None
,
_LOST_CB_TYPE
)
def
raw_cb_
(
_
,
data
,
size
):
try
:
callback
(
cpu
,
data
,
size
)
except
IOError
,
e
:
if
e
.
errno
==
errno
.
EPIPE
:
exit
()
else
:
raise
e
def
lost_cb_
(
lost
):
try
:
lost_cb
(
lost
)
except
IOError
,
e
:
if
e
.
errno
==
errno
.
EPIPE
:
exit
()
else
:
raise
e
fn
=
_RAW_CB_TYPE
(
raw_cb_
)
lost_fn
=
_LOST_CB_TYPE
(
lost_cb_
)
if
lost_cb
else
ct
.
cast
(
None
,
_LOST_CB_TYPE
)
reader
=
lib
.
bpf_open_perf_buffer
(
fn
,
lost_fn
,
None
,
-
1
,
cpu
,
page_cnt
)
if
not
reader
:
raise
Exception
(
"Could not open perf buffer"
)
...
...
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