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
25be6bb4
Commit
25be6bb4
authored
Dec 20, 2017
by
yonghong-song
Committed by
GitHub
Dec 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1496 from palmtenor/fix_lost
Fix and improvement for perf_reader's lost_cb
parents
73b5401f
b7bbd04f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
7 deletions
+15
-7
src/cc/libbpf.h
src/cc/libbpf.h
+1
-1
src/cc/perf_reader.c
src/cc/perf_reader.c
+10
-2
src/lua/bcc/libbcc.lua
src/lua/bcc/libbcc.lua
+1
-1
src/lua/bcc/table.lua
src/lua/bcc/table.lua
+2
-2
src/python/bcc/libbcc.py
src/python/bcc/libbcc.py
+1
-1
No files found.
src/cc/libbpf.h
View file @
25be6bb4
...
...
@@ -68,7 +68,7 @@ int bpf_open_raw_sock(const char *name);
typedef
void
(
*
perf_reader_cb
)(
void
*
cb_cookie
,
int
pid
,
uint64_t
callchain_num
,
void
*
callchain
);
typedef
void
(
*
perf_reader_raw_cb
)(
void
*
cb_cookie
,
void
*
raw
,
int
raw_size
);
typedef
void
(
*
perf_reader_lost_cb
)(
uint64_t
lost
);
typedef
void
(
*
perf_reader_lost_cb
)(
void
*
cb_cookie
,
uint64_t
lost
);
void
*
bpf_attach_kprobe
(
int
progfd
,
enum
bpf_probe_attach_type
attach_type
,
const
char
*
ev_name
,
const
char
*
fn_name
,
...
...
src/cc/perf_reader.c
View file @
25be6bb4
...
...
@@ -243,9 +243,17 @@ void perf_reader_event_read(struct perf_reader *reader) {
}
if
(
e
->
type
==
PERF_RECORD_LOST
)
{
uint64_t
lost
=
*
(
uint64_t
*
)(
ptr
+
sizeof
(
*
e
));
/*
* struct {
* struct perf_event_header header;
* u64 id;
* u64 lost;
* struct sample_id sample_id;
* };
*/
uint64_t
lost
=
*
(
uint64_t
*
)(
ptr
+
sizeof
(
*
e
)
+
sizeof
(
uint64_t
));
if
(
reader
->
lost_cb
)
{
reader
->
lost_cb
(
lost
);
reader
->
lost_cb
(
reader
->
cb_cookie
,
lost
);
}
else
{
fprintf
(
stderr
,
"Possibly lost %"
PRIu64
" samples
\n
"
,
lost
);
}
...
...
src/lua/bcc/libbcc.lua
View file @
25be6bb4
...
...
@@ -41,7 +41,7 @@ int bpf_open_raw_sock(const char *name);
typedef void (*perf_reader_cb)(void *cb_cookie, int pid, uint64_t callchain_num, void *callchain);
typedef void (*perf_reader_raw_cb)(void *cb_cookie, void *raw, int raw_size);
typedef void (*perf_reader_lost_cb)(uint64_t lost);
typedef void (*perf_reader_lost_cb)(
void *cb_cookie,
uint64_t lost);
void *bpf_attach_kprobe(int progfd, int attach_type, const char *ev_name,
const char *fn_name, perf_reader_cb cb,
...
...
src/lua/bcc/table.lua
View file @
25be6bb4
...
...
@@ -252,8 +252,8 @@ function PerfEventArray:_open_perf_buffer(cpu, callback, ctype, page_cnt, lost_c
local
_lost_cb
=
nil
if
lost_cb
then
_lost_cb
=
ffi
.
cast
(
"perf_reader_lost_cb"
,
function
(
lost
)
lost_cb
(
lost
)
function
(
cookie
,
lost
)
lost_cb
(
cookie
,
lost
)
end
)
end
...
...
src/python/bcc/libbcc.py
View file @
25be6bb4
...
...
@@ -89,7 +89,7 @@ lib.bpf_attach_kprobe.restype = ct.c_void_p
_CB_TYPE
=
ct
.
CFUNCTYPE
(
None
,
ct
.
py_object
,
ct
.
c_int
,
ct
.
c_ulonglong
,
ct
.
POINTER
(
ct
.
c_ulonglong
))
_RAW_CB_TYPE
=
ct
.
CFUNCTYPE
(
None
,
ct
.
py_object
,
ct
.
c_void_p
,
ct
.
c_int
)
_LOST_CB_TYPE
=
ct
.
CFUNCTYPE
(
None
,
ct
.
c_ulonglong
)
_LOST_CB_TYPE
=
ct
.
CFUNCTYPE
(
None
,
ct
.
py_object
,
ct
.
c_ulonglong
)
lib
.
bpf_attach_kprobe
.
argtypes
=
[
ct
.
c_int
,
ct
.
c_int
,
ct
.
c_char_p
,
ct
.
c_char_p
,
_CB_TYPE
,
ct
.
py_object
]
lib
.
bpf_detach_kprobe
.
restype
=
ct
.
c_int
...
...
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