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
c7417dcc
Commit
c7417dcc
authored
Dec 13, 2017
by
Teng Qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add C++ helper to clear BPF tables
parent
e5db52bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
src/cc/api/BPFTable.cc
src/cc/api/BPFTable.cc
+6
-0
src/cc/api/BPFTable.h
src/cc/api/BPFTable.h
+15
-0
No files found.
src/cc/api/BPFTable.cc
View file @
c7417dcc
...
...
@@ -106,6 +106,12 @@ BPFStackTable::~BPFStackTable() {
bcc_free_symcache
(
it
.
second
,
it
.
first
);
}
void
BPFStackTable
::
clear_table_non_atomic
()
{
for
(
int
i
=
0
;
i
<
capacity
();
i
++
)
{
remove
(
&
i
);
}
}
std
::
vector
<
uintptr_t
>
BPFStackTable
::
get_stack_addr
(
int
stack_id
)
{
std
::
vector
<
uintptr_t
>
res
;
stacktrace_t
stack
;
...
...
src/cc/api/BPFTable.h
View file @
c7417dcc
...
...
@@ -196,6 +196,20 @@ class BPFHashTable : public BPFTableBase<KeyType, ValueType> {
return
res
;
}
StatusTuple
clear_table_non_atomic
()
{
KeyType
cur
;
if
(
!
this
->
first
(
&
cur
))
return
StatusTuple
(
0
);
while
(
true
)
{
TRY2
(
remove_value
(
cur
));
if
(
!
this
->
next
(
&
cur
,
&
cur
))
break
;
}
return
StatusTuple
(
0
);
}
};
// From src/cc/export/helpers.h
...
...
@@ -211,6 +225,7 @@ class BPFStackTable : public BPFTableBase<int, stacktrace_t> {
bool
check_debug_file_crc
);
~
BPFStackTable
();
void
clear_table_non_atomic
();
std
::
vector
<
uintptr_t
>
get_stack_addr
(
int
stack_id
);
std
::
vector
<
std
::
string
>
get_stack_symbol
(
int
stack_id
,
int
pid
);
...
...
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