Git Product home page Git Product logo

bpf-allocator-bench's Introduction

BPF-Allocator-Bench

This is a makeshift program that stresses the BPF JIT memory allocator and measures TLB performance. It uses biolerplate from libbpf-bootstrap for building BPF programs.

It has a stress.bpf.c file that includes 8 BPF programs (6 tp and 2 kprobe). The userspace stress.c program loads the BPF programs and then triggeres 5 of them continously in a infinite loop by doing system calls.

The run.sh wrapper program starts 20 instances of the above stress program which technically loads 8 * 20 = 160 BPF programs on the system out of which 5 * 20 = 100 are continously triggered.

The run.sh program takes a command as an argument that it runs after doing the above setup. For example to measure the TLB metrics we can run the program like:

./run.sh "perf stat -e ITLB_WALK,L1I_TLB,INST_RETIRED,iTLB-load-misses -a --timeout 60000"

Running the above with different BPF memory allocators will show the differences in their performance.

bpf-allocator-bench's People

Contributors

puranjaymohan avatar

Stargazers

Maxwell Bland avatar Yufeng Li avatar Dima Tisnek avatar

Watchers

James Cloos avatar  avatar  avatar

bpf-allocator-bench's Issues

Update to cross-compiling instructions

Hey, I can do a pull req. but it took me a bit to get this repo together and try to use it to test some ARM code changes I was doing. Figured it would be good to add the following to README.md, but entirely up to you.

arm64 cross-compiling setup

For cross-compiling, there is no need to compile bpftool as part of the build, simply

root=$(pwd)
cd <linux repo>/tools/bpf/bpftool
bpftool_root=$(pwd)
make  ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
cd "$root"
mkdir -p ./src/.output/bpftool/
cp -r "$bpftool_root"/* ./src/.output/bpftool/

Then patch the makefile as follows (gcc is used for standard debian distros):

diff --git a/Makefile b/Makefile
index 78ccdff..b06d659 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ define allow-override
     $(eval $(1) = $(2)))
 endef
 
-$(call allow-override,CC,$(CROSS_COMPILE)cc)
+$(call allow-override,CC,$(CROSS_COMPILE)gcc)
 $(call allow-override,LD,$(CROSS_COMPILE)ld)
 
 .PHONY: all
@@ -78,7 +78,7 @@ $(LIBBPF_OBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPU
 # Build bpftool
 $(BPFTOOL): | $(BPFTOOL_OUTPUT)
        $(call msg,BPFTOOL,$@)
-       $(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap
+       # $(Q)$(MAKE) CFLAGS=$(CFLAGS) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap
 
 # Build BPF code
 $(OUTPUT)/%.bpf.o: src/%.bpf.c $(LIBBPF_OBJ) $(wildcard %.h) $(VMLINUX) | $(OUTPUT) $(BPFTOOL)

Last, make sure you handle the libelf dependencies for arm64

sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install libelf-dev:arm64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.