Commit 0bd29aab authored by Teng Qin's avatar Teng Qin

BPFPerfBuffer: Make it more clear that timeout is milliseconds

parent 861bac09
...@@ -443,11 +443,11 @@ StatusTuple BPF::close_perf_buffer(const std::string& name) { ...@@ -443,11 +443,11 @@ StatusTuple BPF::close_perf_buffer(const std::string& name) {
return StatusTuple(0); return StatusTuple(0);
} }
void BPF::poll_perf_buffer(const std::string& name, int timeout) { void BPF::poll_perf_buffer(const std::string& name, int timeout_ms) {
auto it = perf_buffers_.find(name); auto it = perf_buffers_.find(name);
if (it == perf_buffers_.end()) if (it == perf_buffers_.end())
return; return;
it->second->poll(timeout); it->second->poll(timeout_ms);
} }
StatusTuple BPF::load_func(const std::string& func_name, bpf_prog_type type, StatusTuple BPF::load_func(const std::string& func_name, bpf_prog_type type,
......
...@@ -141,7 +141,7 @@ class BPF { ...@@ -141,7 +141,7 @@ class BPF {
void* cb_cookie = nullptr, void* cb_cookie = nullptr,
int page_cnt = DEFAULT_PERF_BUFFER_PAGE_CNT); int page_cnt = DEFAULT_PERF_BUFFER_PAGE_CNT);
StatusTuple close_perf_buffer(const std::string& name); StatusTuple close_perf_buffer(const std::string& name);
void poll_perf_buffer(const std::string& name, int timeout = -1); void poll_perf_buffer(const std::string& name, int timeout_ms = -1);
StatusTuple load_func(const std::string& func_name, enum bpf_prog_type type, StatusTuple load_func(const std::string& func_name, enum bpf_prog_type type,
int& fd); int& fd);
......
...@@ -295,10 +295,10 @@ StatusTuple BPFPerfBuffer::close_all_cpu() { ...@@ -295,10 +295,10 @@ StatusTuple BPFPerfBuffer::close_all_cpu() {
return StatusTuple(0); return StatusTuple(0);
} }
void BPFPerfBuffer::poll(int timeout) { void BPFPerfBuffer::poll(int timeout_ms) {
if (epfd_ < 0) if (epfd_ < 0)
return; return;
int cnt = epoll_wait(epfd_, ep_events_.get(), cpu_readers_.size(), timeout); int cnt = epoll_wait(epfd_, ep_events_.get(), cpu_readers_.size(), timeout_ms);
if (cnt <= 0) if (cnt <= 0)
return; return;
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
......
...@@ -309,7 +309,7 @@ class BPFPerfBuffer : public BPFTableBase<int, int> { ...@@ -309,7 +309,7 @@ class BPFPerfBuffer : public BPFTableBase<int, int> {
StatusTuple open_all_cpu(perf_reader_raw_cb cb, perf_reader_lost_cb lost_cb, StatusTuple open_all_cpu(perf_reader_raw_cb cb, perf_reader_lost_cb lost_cb,
void* cb_cookie, int page_cnt); void* cb_cookie, int page_cnt);
StatusTuple close_all_cpu(); StatusTuple close_all_cpu();
void poll(int timeout); void poll(int timeout_ms);
private: private:
StatusTuple open_on_cpu(perf_reader_raw_cb cb, perf_reader_lost_cb lost_cb, StatusTuple open_on_cpu(perf_reader_raw_cb cb, perf_reader_lost_cb lost_cb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment