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
e5e9b1f5
Commit
e5e9b1f5
authored
Apr 25, 2018
by
Teng Qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic support of Cgroup Array
parent
18a2f2f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/cc/export/helpers.h
src/cc/export/helpers.h
+11
-0
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+5
-0
No files found.
src/cc/export/helpers.h
View file @
e5e9b1f5
...
...
@@ -103,6 +103,17 @@ struct _name##_table_t { \
__attribute__((section("
maps
/
perf_array
"))) \
struct _name##_table_t _name = { .max_entries = (_max_entries) }
// Table for cgroup file descriptors
#define BPF_CGROUP_ARRAY(_name, _max_entries) \
struct _name##_table_t { \
int key; \
u32 leaf; \
int (*check_current_task) (int); \
u32 max_entries; \
}; \
__attribute__((section("
maps
/
cgroup_array
"))) \
struct _name##_table_t _name = { .max_entries = (_max_entries) }
#define BPF_HASH1(_name) \
BPF_TABLE("
hash
", u64, u64, _name, 10240)
#define BPF_HASH2(_name, _key_type) \
...
...
src/cc/frontends/clang/b_frontend_action.cc
View file @
e5e9b1f5
...
...
@@ -459,6 +459,9 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
}
else
if
(
memb_name
==
"perf_counter_value"
)
{
prefix
=
"bpf_perf_event_read_value"
;
suffix
=
")"
;
}
else
if
(
memb_name
==
"check_current_task"
)
{
prefix
=
"bpf_current_task_under_cgroup"
;
suffix
=
")"
;
}
else
{
error
(
Call
->
getLocStart
(),
"invalid bpf_table operation %0"
)
<<
memb_name
;
return
false
;
...
...
@@ -762,6 +765,8 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
table
.
max_entries
=
numcpu
;
}
else
if
(
A
->
getName
()
==
"maps/perf_array"
)
{
map_type
=
BPF_MAP_TYPE_PERF_EVENT_ARRAY
;
}
else
if
(
A
->
getName
()
==
"maps/cgroup_array"
)
{
map_type
=
BPF_MAP_TYPE_CGROUP_ARRAY
;
}
else
if
(
A
->
getName
()
==
"maps/stacktrace"
)
{
map_type
=
BPF_MAP_TYPE_STACK_TRACE
;
}
else
if
(
A
->
getName
()
==
"maps/extern"
)
{
...
...
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