diff --git a/source/tools/monitor/raptor/source/Makefile b/source/tools/monitor/raptor/source/Makefile index bff8a438c3777f708bc5f7c6351d643b84c1bc65..10a3467d4a7b9de1e82a36c2057730efed5a4985 100644 --- a/source/tools/monitor/raptor/source/Makefile +++ b/source/tools/monitor/raptor/source/Makefile @@ -11,9 +11,9 @@ GOLDFLAGS := EXTRA_CGO_CFLAGS := -I$(abspath ./profile/third/libbpf/lib/include) \ -I$(abspath ./ebpf/src/lib/include) -EXTRA_CGO_LDFLAGS := -L$(abspath ./ebpf/src/lib) -lbpf \ - -L$(abspath ./ebpf/src/lib) -lbcc-syms -lstdc++ -lelf -lz \ - -L$(abspath ./ebpf/src/) -lnginx +EXTRA_CGO_LDFLAGS := -L$(abspath ./ebpf/src/libbpf/lib/lib64) -lbpf \ + -L$(abspath ./ebpf/src/bcc/lib/lib) -lbcc-syms -lstdc++ -lelf -lz \ + -L$(abspath ./ebpf/src/lib) -lnginx .PHONY: build build: @echo "COMPLIE GOLANG..." @@ -30,13 +30,14 @@ ebpf: # hard code cp -f ebpf/src/libnginx.a nginx/ cp -f ebpf/src/*.o profile/agent/ebpf/bpf - cp -f ebpf/src/*.o nginx + cp -f ebpf/src/nginx.bpf.o nginx .PHONY: profile profile: @echo "COMPLIE eBPF PROFILE..." $(MAKE) -C ebpf/src profile cp -f ebpf/src/*.o profile/agent/ebpf/bpf + cp -f ebpf/src/nginx.bpf.o nginx .PHONY: clean clean: diff --git a/source/tools/monitor/raptor/source/ebpf/src/Makefile b/source/tools/monitor/raptor/source/ebpf/src/Makefile index 2a23b94258a0882467eaf002b13844e47cb0a50a..c8e036c4f6d496ddb3aa144a5f876d49c9d94f4a 100644 --- a/source/tools/monitor/raptor/source/ebpf/src/Makefile +++ b/source/tools/monitor/raptor/source/ebpf/src/Makefile @@ -12,7 +12,7 @@ LIBBPF_VERSION ?= v0.8.1 # outdated INCLUDES := -I$(OUTPUT) -I../../libbpf/include/uapi -I$(dir $(VMLINUX)) CFLAGS := -g -Wall -fPIC -MYCFLAGS := -ggdb -gdwarf -O2 -Wall -fpie -Wno-unused-variable -Wno-unused-function +MYCFLAGS := -ggdb -gdwarf -O2 -Wall -fpie -Wno-unused-variable -Wno-unused-function -I./lib/include ARCH := $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' | sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/') APPS = net nginx @@ -99,13 +99,12 @@ libnginx.a: $(OUTPUT)/nginx.o $(LIBBPF_OBJ) $(COMM_OBJ) | $(OUTPUT) $(call msg,BINARY,$@) $(Q)$(AR) rcs $@ $^ -.PHONY: build_libbpf -build_libbpf: - test -d bpfsrc || git clone https://github.com/libbpf/libbpf bpfsrc - cd bpfsrc && git checkout $(LIBBPF_VERSION) - PREFIX=$(shell pwd)/lib make -C bpfsrc/src -j16 install +.PHONY: build_bpf +build_bpf: + make -C bcc/ + make -C libbpf/ -profile: oncpu.bpf.o offcpu.bpf.o user_slow.bpf.o ping_slow.bpf.o nginx.bpf.o +profile: oncpu.bpf.o offcpu.bpf.o user_slow.bpf.o ping_slow.bpf.o nginx.bpf.o build_bpf oncpu.bpf.o: oncpu.bpf.c profile.bpf.h $(VMLINUX) $(CLANG) $(MYCFLAGS) -target bpf -D__TARGET_ARCH_x86 -I. -c oncpu.bpf.c -o $@ diff --git a/source/tools/monitor/raptor/source/ebpf/src/bcc/Makefile b/source/tools/monitor/raptor/source/ebpf/src/bcc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..789e80f5886f2b6e76daa62ab23f1a4e2793b90d --- /dev/null +++ b/source/tools/monitor/raptor/source/ebpf/src/bcc/Makefile @@ -0,0 +1,19 @@ +BCC_VERSION ?= b9554b585afe18540ba98dde5b667e5b4036f479 + +.PHONY: bcc +bcc: + test -d src || git clone http://github.com/korniltsev/bcc src + cd src && git checkout $(BCC_VERSION) + test -d src/build && rm -rf src/build || echo bcc src/build dir does not exits + mkdir src/build + cd src/build \ + && cmake ../build-syms \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$(shell pwd)/lib \ + && make -j16 install + +.PHONY: clean +clean: + rm -rf src lib diff --git a/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.a b/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.a new file mode 100644 index 0000000000000000000000000000000000000000..a864dd1bf45f41fa6a42299b456e1ebd55341b3e Binary files /dev/null and b/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.a differ diff --git a/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.so b/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.so new file mode 100755 index 0000000000000000000000000000000000000000..00fa7336af8f523b8f8b06cc6887d6670ba43472 Binary files /dev/null and b/source/tools/monitor/raptor/source/ebpf/src/bcc/lib/lib/libbcc-syms.so differ diff --git a/source/tools/monitor/raptor/source/ebpf/src/bcc/src b/source/tools/monitor/raptor/source/ebpf/src/bcc/src new file mode 160000 index 0000000000000000000000000000000000000000..b9554b585afe18540ba98dde5b667e5b4036f479 --- /dev/null +++ b/source/tools/monitor/raptor/source/ebpf/src/bcc/src @@ -0,0 +1 @@ +Subproject commit b9554b585afe18540ba98dde5b667e5b4036f479 diff --git a/source/tools/monitor/raptor/source/ebpf/src/libbpf/Makefile b/source/tools/monitor/raptor/source/ebpf/src/libbpf/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..493bc8a87bee207f9f18538e389b84a240af2159 --- /dev/null +++ b/source/tools/monitor/raptor/source/ebpf/src/libbpf/Makefile @@ -0,0 +1,12 @@ +LIBBPF_VERSION ?= v0.8.1 + +.PHONY: libbpf +libbpf: + test -d src || git clone https://github.com/libbpf/libbpf src + #test -d src || git clone git@github.com:libbpf/libbpf.git src + cd src && git checkout $(LIBBPF_VERSION) + PREFIX=$(shell pwd)/lib make -C src/src -j16 install + +.PHONY: clean +clean: + rm -rf src lib diff --git a/source/tools/monitor/raptor/source/ebpf/src/vmlinux.h b/source/tools/monitor/raptor/source/ebpf/src/vmlinux.h new file mode 120000 index 0000000000000000000000000000000000000000..35eead2ebaf3da609f6a25bc34529f9b2d7ddc41 --- /dev/null +++ b/source/tools/monitor/raptor/source/ebpf/src/vmlinux.h @@ -0,0 +1 @@ +vmlinux/vmlinux.h \ No newline at end of file diff --git a/source/tools/monitor/raptor/source/raptor_nginx b/source/tools/monitor/raptor/source/raptor_nginx deleted file mode 100755 index 935b318b9c0ab3185c333096374444cecae7b89b..0000000000000000000000000000000000000000 Binary files a/source/tools/monitor/raptor/source/raptor_nginx and /dev/null differ