OpenSuSE 安装bpftrace

来源:清泛原创     2021-09-23 09:57:15    人气:     我有话说( 0 人参与)

1、可以选择源码安装,依赖顺序是:bpftrace <-- bcc <-- llvm clang不过过程难免曲折,可以继续探究或选择二进制包安装。2、先安装bcc及依赖(参考:INSTALL md):zypper s

1、可以选择源码安装,依赖顺序是:
bpftrace <-- bcc <-- llvm/clang
不过过程难免曲折,可以继续探究或选择二进制包安装。

2、先安装bcc及依赖(参考:INSTALL.md):
zypper se bcc
zypper install bcc-devel
#zypper install bcc-devel-0.22.0-lp151.127.1.x86_64 #安装失败的话,可以尝试

3、安装bpftrace(参考:INSTALL.md):
OCICLI https://software.opensuse.org/ymp/home:pavlix:Kernel/openSUSE_Leap_15.1/bpftrace.ymp

4、验证:
bpftrace
USAGE:
    bpftrace [options] filename
    bpftrace [options] -e 'program'

OPTIONS:
    -B MODE        output buffering mode ('full', 'none')
    -f FORMAT      output format ('text', 'json')
    -o file        redirect bpftrace output to file
    -d             debug info dry run
    -dd            verbose debug info dry run
    -b             force BTF (BPF type format) processing
    -e 'program'   execute this program
    -h, --help     show this help message
    -I DIR         add the directory to the include search path
    --include FILE add an #include file before preprocessing
    -l [search]    list probes
    -p PID         enable USDT probes on PID
    -c 'CMD'       run CMD and enable USDT probes on resulting process
    --unsafe       allow unsafe builtin functions
    -v             verbose messages
    --info         Print information about kernel BPF support
    -V, --version  bpftrace version

ENVIRONMENT:
    BPFTRACE_STRLEN             [default: 64] bytes on BPF stack per str()
    BPFTRACE_NO_CPP_DEMANGLE    [default: 0] disable C++ symbol demangling
    BPFTRACE_MAP_KEYS_MAX       [default: 4096] max keys in a map
    BPFTRACE_CAT_BYTES_MAX      [default: 10k] maximum bytes read by cat builtin
    BPFTRACE_MAX_PROBES         [default: 512] max number of probes
    BPFTRACE_LOG_SIZE           [default: 409600] log size in bytes
    BPFTRACE_NO_USER_SYMBOLS    [default: 0] disable user symbol resolution
    BPFTRACE_CACHE_USER_SYMBOLS [default: auto] enable user symbol cache
    BPFTRACE_VMLINUX            [default: none] vmlinux path used for kernel symbol resolution
    BPFTRACE_BTF                [default: none] BTF file

EXAMPLES:
bpftrace -l '*sleep*'
    list probes containing "sleep"
bpftrace -e 'kprobe:do_nanosleep { printf("PID %d sleeping...\n", pid); }'
    trace processes calling sleep
bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @[comm] = count(); }'
    count syscalls by process name
--End--

bpftrace bpf

注:本文为本站或本站会员原创优质内容,版权属于原作者及清泛网所有,
欢迎转载,转载时须注明版权并添加来源链接,谢谢合作! (编辑:admin)
分享到: