-
Notifications
You must be signed in to change notification settings - Fork 656
Expand file tree
/
Copy pathBpfMapMonitor.h
More file actions
36 lines (26 loc) · 907 Bytes
/
BpfMapMonitor.h
File metadata and controls
36 lines (26 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* -*- Mode: C++; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
#ifndef RR_BPF_MAP_MONITOR_H_
#define RR_BPF_MAP_MONITOR_H_
#include "FileMonitor.h"
namespace rr {
/**
* A FileMonitor attached to BPF map fds to record their key and value size.
*/
class BpfMapMonitor : public FileMonitor {
public:
BpfMapMonitor(uint64_t key_size, uint64_t value_size) : key_size_(key_size), value_size_(value_size) {}
virtual Type type() const override { return BpfMap; }
uint64_t key_size() const { return key_size_; }
uint64_t value_size() const { return value_size_; }
private:
virtual void serialize_type(
pcp::FileMonitor::Builder& builder) const noexcept override {
auto bpf = builder.initBpf();
bpf.setKeySize(key_size_);
bpf.setValueSize(value_size_);
}
uint64_t key_size_;
uint64_t value_size_;
};
} // namespace rr
#endif /* RR_BPF_MAP_MONITOR_H_ */