samples/bpf: add perf_event+bpf example
The bpf program is called 50 times a second and does hashmap[kern&user_stackid]++ It's primary purpose to check that key bpf helpers like map lookup, update, get_stackid, trace_printk and ctx access are all working. It checks: - PERF_COUNT_HW_CPU_CYCLES on all cpus - PERF_COUNT_HW_CPU_CYCLES for current process and inherited perf_events to children - PERF_COUNT_SW_CPU_CLOCK on all cpus - PERF_COUNT_SW_CPU_CLOCK for current process Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Tento commit je obsažen v:

odevzdal
David S. Miller

rodič
aa6a5f3cb2
revize
1c47910ef8
@@ -25,6 +25,7 @@ hostprogs-y += test_cgrp2_array_pin
|
||||
hostprogs-y += xdp1
|
||||
hostprogs-y += xdp2
|
||||
hostprogs-y += test_current_task_under_cgroup
|
||||
hostprogs-y += trace_event
|
||||
|
||||
test_verifier-objs := test_verifier.o libbpf.o
|
||||
test_maps-objs := test_maps.o libbpf.o
|
||||
@@ -52,6 +53,7 @@ xdp1-objs := bpf_load.o libbpf.o xdp1_user.o
|
||||
xdp2-objs := bpf_load.o libbpf.o xdp1_user.o
|
||||
test_current_task_under_cgroup-objs := bpf_load.o libbpf.o \
|
||||
test_current_task_under_cgroup_user.o
|
||||
trace_event-objs := bpf_load.o libbpf.o trace_event_user.o
|
||||
|
||||
# Tell kbuild to always build the programs
|
||||
always := $(hostprogs-y)
|
||||
@@ -79,6 +81,7 @@ always += test_cgrp2_tc_kern.o
|
||||
always += xdp1_kern.o
|
||||
always += xdp2_kern.o
|
||||
always += test_current_task_under_cgroup_kern.o
|
||||
always += trace_event_kern.o
|
||||
|
||||
HOSTCFLAGS += -I$(objtree)/usr/include
|
||||
|
||||
@@ -103,6 +106,7 @@ HOSTLOADLIBES_test_overhead += -lelf -lrt
|
||||
HOSTLOADLIBES_xdp1 += -lelf
|
||||
HOSTLOADLIBES_xdp2 += -lelf
|
||||
HOSTLOADLIBES_test_current_task_under_cgroup += -lelf
|
||||
HOSTLOADLIBES_trace_event += -lelf
|
||||
|
||||
# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
|
||||
# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele