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
4186f5ec
Commit
4186f5ec
authored
Dec 15, 2017
by
Teng Qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new bpf_perf_{event|prog}_read_value helpers implementation
parent
99978d23
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
docs/kernel-versions.md
docs/kernel-versions.md
+2
-0
src/cc/export/helpers.h
src/cc/export/helpers.h
+5
-0
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+3
-0
No files found.
docs/kernel-versions.md
View file @
4186f5ec
...
@@ -159,3 +159,5 @@ Helper | Kernel version | Commit
...
@@ -159,3 +159,5 @@ Helper | Kernel version | Commit
`BPF_FUNC_tail_call()`
| 4.2 |
[
04fd61ab36ec
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=04fd61ab36ec065e194ab5e74ae34a5240d992bb
)
`BPF_FUNC_tail_call()`
| 4.2 |
[
04fd61ab36ec
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=04fd61ab36ec065e194ab5e74ae34a5240d992bb
)
`BPF_FUNC_trace_printk()`
| 4.1 |
[
9c959c863f82
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9c959c863f8217a2ff3d7c296e8223654d240569
)
`BPF_FUNC_trace_printk()`
| 4.1 |
[
9c959c863f82
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9c959c863f8217a2ff3d7c296e8223654d240569
)
`BPF_FUNC_xdp_adjust_head()`
| 4.10 |
[
17bedab27231
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17bedab2723145d17b14084430743549e6943d03
)
`BPF_FUNC_xdp_adjust_head()`
| 4.10 |
[
17bedab27231
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17bedab2723145d17b14084430743549e6943d03
)
`BPF_FUNC_perf_event_read_value()`
| 4.15 |
[
908432ca84fc
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=908432ca84fc229e906ba164219e9ad0fe56f755
)
`BPF_FUNC_perf_prog_read_value()`
| 4.15 |
[
4bebdc7a85aa
](
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4bebdc7a85aa400c0222b5329861e4ad9252f1e5
)
src/cc/export/helpers.h
View file @
4186f5ec
...
@@ -96,6 +96,7 @@ struct _name##_table_t { \
...
@@ -96,6 +96,7 @@ struct _name##_table_t { \
u32 leaf; \
u32 leaf; \
/* counter = map.perf_read(index) */ \
/* counter = map.perf_read(index) */ \
u64 (*perf_read) (int); \
u64 (*perf_read) (int); \
int (*perf_counter_value) (int, void *, u32); \
u32 max_entries; \
u32 max_entries; \
}; \
}; \
__attribute__((section("
maps
/
perf_array
"))) \
__attribute__((section("
maps
/
perf_array
"))) \
...
@@ -245,6 +246,10 @@ static int (*bpf_perf_event_output)(void *ctx, void *map, u64 index, void *data,
...
@@ -245,6 +246,10 @@ static int (*bpf_perf_event_output)(void *ctx, void *map, u64 index, void *data,
(void *) BPF_FUNC_perf_event_output;
(void *) BPF_FUNC_perf_event_output;
static int (*bpf_skb_load_bytes)(void *ctx, int offset, void *to, u32 len) =
static int (*bpf_skb_load_bytes)(void *ctx, int offset, void *to, u32 len) =
(void *) BPF_FUNC_skb_load_bytes;
(void *) BPF_FUNC_skb_load_bytes;
static int (*bpf_perf_event_read_value)(void *map, u64 flags, void *buf, u32 buf_size) =
(void *) BPF_FUNC_perf_event_read_value;
static int (*bpf_perf_prog_read_value)(void *ctx, void *buf, u32 buf_size) =
(void *) BPF_FUNC_perf_prog_read_value;
/* bcc_get_stackid will return a negative value in the case of an error
/* bcc_get_stackid will return a negative value in the case of an error
*
*
...
...
src/cc/frontends/clang/b_frontend_action.cc
View file @
4186f5ec
...
@@ -433,6 +433,9 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
...
@@ -433,6 +433,9 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
}
else
if
(
memb_name
==
"perf_read"
)
{
}
else
if
(
memb_name
==
"perf_read"
)
{
prefix
=
"bpf_perf_event_read"
;
prefix
=
"bpf_perf_event_read"
;
suffix
=
")"
;
suffix
=
")"
;
}
else
if
(
memb_name
==
"perf_counter_value"
)
{
prefix
=
"bpf_perf_event_read_value"
;
suffix
=
")"
;
}
else
{
}
else
{
error
(
Call
->
getLocStart
(),
"invalid bpf_table operation %0"
)
<<
memb_name
;
error
(
Call
->
getLocStart
(),
"invalid bpf_table operation %0"
)
<<
memb_name
;
return
false
;
return
false
;
...
...
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