/usr/share/doc/bpfcc-tools/examples/tracing
NameSizeModeActions
biolatpcts.py33120755editdlrm
biolatpcts_example.txt6500644editdlrm
bitehist.py13970755editdlrm
bitehist_example.txt12080644editdlrm
CMakeLists.txt2760644editdlrm
dddos.py38180755editdlrm
dddos_example.txt21120644editdlrm
disksnoop.py19470755editdlrm
disksnoop_example.txt15870644editdlrm
hello_fields.py6790755editdlrm
hello_perf_output.py12700755editdlrm
hello_perf_output_using_ns.py18430755editdlrm
kvm_hypercall.py15200755editdlrm
kvm_hypercall.txt17820644editdlrm
mallocstacks.py19420755editdlrm
mysqld_query.py17010755editdlrm
mysqld_query_example.txt4990644editdlrm
nflatency.py62140755editdlrm
nodejs_http_server.py13760755editdlrm
nodejs_http_server_example.txt2760644editdlrm
stacksnoop.py32520755editdlrm
stacksnoop_example.txt28710644editdlrm
stack_buildid_example.py31060755editdlrm
strlen_count.py13310755editdlrm
strlen_hist.py18560755editdlrm
strlen_hist_ifunc.py38000755editdlrm
strlen_snoop.py13840755editdlrm
sync_timing.py13900755editdlrm
task_switch.c4990644editdlrm
task_switch.py4860755editdlrm
tcpv4connect.py24130755editdlrm
tcpv4connect_example.txt10630644editdlrm
trace_fields.py5890755editdlrm
trace_perf_output.py16000755editdlrm
undump.py36020755editdlrm
undump_example.txt8860644editdlrm
urandomread-explicit.py15110755editdlrm
urandomread.py10320755editdlrm
urandomread_example.txt6750644editdlrm
vfsreadlat.c8960644editdlrm
vfsreadlat.py13360755editdlrm
vfsreadlat_example.txt36190644editdlrm
Edit: /usr/share/doc/bpfcc-tools/examples/tracing/hello_fields.py (679B)
#!/usr/bin/python # # This is a Hello World example that formats output as fields. from bcc import BPF from bcc.utils import printb # define BPF program prog = """ int hello(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; } """ # load BPF program b = BPF(text=prog) b.attach_kprobe(event=b.get_syscall_fnname("clone"), fn_name="hello") # header print("%-18s %-16s %-6s %s" % ("TIME(s)", "COMM", "PID", "MESSAGE")) # format output while 1: try: (task, pid, cpu, flags, ts, msg) = b.trace_fields() except ValueError: continue except KeyboardInterrupt: exit() printb(b"%-18.9f %-16s %-6d %s" % (ts, task, pid, msg))