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
860dbb08
Commit
860dbb08
authored
Oct 14, 2017
by
Paul Chaignon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exit on EPIPE
parent
5b08d385
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 @
860dbb08
...
@@ -17,6 +17,7 @@ import ctypes as ct
...
@@ -17,6 +17,7 @@ import ctypes as ct
from
functools
import
reduce
from
functools
import
reduce
import
multiprocessing
import
multiprocessing
import
os
import
os
import
errno
from
.libbcc
import
lib
,
_RAW_CB_TYPE
,
_LOST_CB_TYPE
from
.libbcc
import
lib
,
_RAW_CB_TYPE
,
_LOST_CB_TYPE
from
.perf
import
Perf
from
.perf
import
Perf
...
@@ -523,8 +524,24 @@ class PerfEventArray(ArrayBase):
...
@@ -523,8 +524,24 @@ class PerfEventArray(ArrayBase):
self
.
_open_perf_buffer
(
i
,
callback
,
page_cnt
,
lost_cb
)
self
.
_open_perf_buffer
(
i
,
callback
,
page_cnt
,
lost_cb
)
def
_open_perf_buffer
(
self
,
cpu
,
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
))
def
raw_cb_
(
_
,
data
,
size
):
lost_fn
=
_LOST_CB_TYPE
(
lambda
lost
:
lost_cb
(
lost
))
if
lost_cb
else
ct
.
cast
(
None
,
_LOST_CB_TYPE
)
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
)
reader
=
lib
.
bpf_open_perf_buffer
(
fn
,
lost_fn
,
None
,
-
1
,
cpu
,
page_cnt
)
if
not
reader
:
if
not
reader
:
raise
Exception
(
"Could not open perf buffer"
)
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