Skip to content

Commit

Permalink
add frame point information for optimizing itself
Browse files Browse the repository at this point in the history
  • Loading branch information
GorilaMond committed Sep 22, 2023
1 parent df33eee commit a4122a9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions eBPF_Supermarket/Stack_Analyser/libbpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ ARCH ?= $(shell echo $(ORIG_ARCH) | sed 's/x86_64/x86/' \
APP = stack_analyzer
bpf = on_cpu_count off_cpu_count mem_count io_count pre_count

CFLAGS += -O2 -Wall
#
# Pedantic flags
#
ifeq ($(PEDANTIC),1)
CFLAGS += -g -fno-omit-frame-pointer
endif

all: vmlinux.h $(bpf) symbol
clang -g -O2 -Wall -I. -I./include -c $(APP).cc -o $(APP).o
clang -Wall -O2 -g $(APP).o symbol.o elf.o -static -lbpf -lelf -lz -lstdc++ -o $(APP)
clang $(CFLAGS) -I. -I./include -c $(APP).cc -o $(APP).o
clang $(CFLAGS) $(APP).o symbol.o elf.o -static -lbpf -lelf -lz -lstdc++ -o $(APP)

vmlinux.h:
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
Expand All @@ -39,8 +47,8 @@ $(bpf): %: bpf/%.bpf.c
bpftool gen skeleton bpf/$@.bpf.o > bpf/$@.skel.h

symbol: %: include/%.cc
clang -g -O2 -Wall -c include/symbol.cc -o symbol.o
clang -g -O2 -Wall -c include/elf.cc -o elf.o
clang $(CFLAGS) -c include/symbol.cc -o symbol.o
clang $(CFLAGS) -c include/elf.cc -o elf.o

clean:
rm bpf/*.o bpf/*.skel.h *.o $(APP) vmlinux.h

0 comments on commit a4122a9

Please sign in to comment.