1- #include " bpf_perf_buffer .h"
1+ #include " perf_event_array .h"
22#include " core/bpf_exception.h"
33
4- BpfPerfBuffer::BpfPerfBuffer (int map_fd, int page_cnt, py::function callback,
4+ PerfEventArray::PerfEventArray (int map_fd, int page_cnt, py::function callback,
55 py::object lost_callback)
66 : pb_(nullptr ), callback_(std::move(callback)),
77 lost_callback_(lost_callback) {
@@ -27,15 +27,15 @@ BpfPerfBuffer::BpfPerfBuffer(int map_fd, int page_cnt, py::function callback,
2727 }
2828}
2929
30- BpfPerfBuffer ::~BpfPerfBuffer () {
30+ PerfEventArray ::~PerfEventArray () {
3131 if (pb_) {
3232 perf_buffer__free (pb_);
3333 }
3434}
3535
36- void BpfPerfBuffer ::sample_callback_wrapper (void *ctx, int cpu, void *data,
36+ void PerfEventArray ::sample_callback_wrapper (void *ctx, int cpu, void *data,
3737 unsigned int size) {
38- auto *self = static_cast <BpfPerfBuffer *>(ctx);
38+ auto *self = static_cast <PerfEventArray *>(ctx);
3939
4040 // Acquire GIL for Python calls
4141 py::gil_scoped_acquire acquire;
@@ -51,9 +51,9 @@ void BpfPerfBuffer::sample_callback_wrapper(void *ctx, int cpu, void *data,
5151 }
5252}
5353
54- void BpfPerfBuffer ::lost_callback_wrapper (void *ctx, int cpu,
54+ void PerfEventArray ::lost_callback_wrapper (void *ctx, int cpu,
5555 unsigned long long cnt) {
56- auto *self = static_cast <BpfPerfBuffer *>(ctx);
56+ auto *self = static_cast <PerfEventArray *>(ctx);
5757
5858 if (self->lost_callback_ .is_none ()) {
5959 return ;
@@ -68,13 +68,13 @@ void BpfPerfBuffer::lost_callback_wrapper(void *ctx, int cpu,
6868 }
6969}
7070
71- int BpfPerfBuffer ::poll (int timeout_ms) {
71+ int PerfEventArray ::poll (int timeout_ms) {
7272 // Release GIL during blocking poll
7373 py::gil_scoped_release release;
7474 return perf_buffer__poll (pb_, timeout_ms);
7575}
7676
77- int BpfPerfBuffer ::consume () {
77+ int PerfEventArray ::consume () {
7878 py::gil_scoped_release release;
7979 return perf_buffer__consume (pb_);
8080}
0 commit comments