Add a bench tool which can be easily used to compare AOT, JIT, and interpreter performance. The result and usage would be like:
$ /home/yunwei/ebpf-xdp-dpdk/build-bpftime/bpftime/tools/bpftimetool/bpftimetool run 3 /home/yunwei/ebpf-xdp-dpdk/bpftime/.clang-format repeat 10 type AOT
Running eBPF program with id 3 and data in file /home/yunwei/ebpf-xdp-dpdk/bpftime/.clang-format
Repeat N: 10 with run type AOT
[2024-03-26 16:04:06.411] [info] [bpftime_shm_internal.cpp:628] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
[2024-03-26 16:04:06.411] [info] [bpftime_shm_internal.cpp:28] Global shm initialized
[2024-03-26 16:04:06.411] [info] [llvm_jit_context.cpp:81] Initializing llvm
[2024-03-26 16:04:06.411] [info] [llvm_jit_context.cpp:204] LLVM-JIT: Loading aot object
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
target_func called.
Time taken: 3392 ns
Return value: 0
INFO [1347842]: Global shm destructed
$ /home/yunwei/ebpf-xdp-dpdk/build-bpftime/bpftime/tools/bpftimetool/bpftimetool run 3 /home/yunwei/ebpf-xdp-dpdk/bpftime/.clang-format repeat 10 type JIT
Running eBPF program with id 3 and data in file /home/yunwei/ebpf-xdp-dpdk/bpftime/.clang-format
Repeat N: 10 with run type JIT
[2024-03-26 16:04:22.925] [info] [bpftime_shm_internal.cpp:628] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
[2024-03-26 16:04:22.925] [info] [bpftime_shm_internal.cpp:28] Global shm initialized
[2024-03-26 16:04:22.925] [info] [llvm_jit_context.cpp:81] Initializing llvm
Time taken: 54 ns
Return value: 0
INFO [1348175]: Global shm destructed
Support load the JIT/AOT result into the share memory, so that it can be run directly
Rename some dir name in vm
In this case, we can easily experiment different kinds of optimize approaches.
We can dump the LLVM IR of any eBPF programs with maps and helpers, compile it with other tools and load it back to run.
Type of change
[ ] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Description
Related to #254
Add a bench tool which can be easily used to compare AOT, JIT, and interpreter performance. The result and usage would be like:
In this case, we can easily experiment different kinds of optimize approaches.
We can dump the LLVM IR of any eBPF programs with maps and helpers, compile it with other tools and load it back to run.
Type of change