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
50295999
Commit
50295999
authored
Apr 02, 2018
by
Andrii Nakryiko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return number of CPUs with data for BPFPerfBufferTable::poll()
parent
b2e68700
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
src/cc/api/BPF.cc
src/cc/api/BPF.cc
+3
-3
src/cc/api/BPF.h
src/cc/api/BPF.h
+5
-1
No files found.
src/cc/api/BPF.cc
View file @
50295999
...
...
@@ -495,11 +495,11 @@ BPFPerfBuffer* BPF::get_perf_buffer(const std::string& name) {
return
(
it
==
perf_buffers_
.
end
())
?
nullptr
:
it
->
second
;
}
void
BPF
::
poll_perf_buffer
(
const
std
::
string
&
name
,
int
timeout_ms
)
{
int
BPF
::
poll_perf_buffer
(
const
std
::
string
&
name
,
int
timeout_ms
)
{
auto
it
=
perf_buffers_
.
find
(
name
);
if
(
it
==
perf_buffers_
.
end
())
return
;
it
->
second
->
poll
(
timeout_ms
);
return
-
1
;
return
it
->
second
->
poll
(
timeout_ms
);
}
StatusTuple
BPF
::
load_func
(
const
std
::
string
&
func_name
,
bpf_prog_type
type
,
...
...
src/cc/api/BPF.h
View file @
50295999
...
...
@@ -155,7 +155,11 @@ class BPF {
BPFPerfBuffer
*
get_perf_buffer
(
const
std
::
string
&
name
);
// Poll an opened Perf Buffer of given name with given timeout, using callback
// provided when opening. Do nothing if such open Perf Buffer doesn't exist.
void
poll_perf_buffer
(
const
std
::
string
&
name
,
int
timeout_ms
=
-
1
);
// Returns:
// -1 on error or if perf buffer with such name doesn't exist;
// 0, if no data was available before timeout;
// number of CPUs that have new data, otherwise.
int
poll_perf_buffer
(
const
std
::
string
&
name
,
int
timeout_ms
=
-
1
);
StatusTuple
load_func
(
const
std
::
string
&
func_name
,
enum
bpf_prog_type
type
,
int
&
fd
);
...
...
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