How iovisor/bcc works
BCC is a toolkit for authoring and running eBPF tracing and manipulation programs, with Python and Lua front ends and a broad suite of tracing tools. The main workflow is a user invoking a tool or API, which compiles and loads instrumentation, attaches it to kernel or user probes, and reads event or map data for presentation. The graph includes major tool families and internal compiler, probe, map, and event layers. Some subsystem links are documented rather than verified in sampled implementation, so those are dashed.
Main entry points: __init__.py Python BPF API · libbcc.py Native bindings · bpf_module.h BPF module runtime · utils.py Python utilities
Components 27
Tracing tools
- Tracing tools
tools/trace.py - Argument analysis
tools/argdist.py - System tool families
tools - libbpf tools
libbpf-tools
Language frontends
- Python BPF API
src/python/bcc/__init__.py - Lua frontend
src/lua/src/main.c - USDT interface
src/python/bcc/usdt.py - Python utilities
src/python/bcc/utils.py - Python map access
src/python/bcc/table.py - Syscall helpers
src/python/bcc/syscall.py - Disassembler
src/python/bcc/disassembler.py - Container helpers
src/python/bcc/containers.py
Compiler and runtime
- Native bindings
src/python/bcc/libbcc.py - Compiler and loader
src/cc/frontends/clang/loader.cc - BPF module runtime
src/cc/bpf_module.h - Read-write engine
src/cc/bpf_module_rw_engine.cc - Exception types
src/cc/bcc_exception.h - Map descriptions
src/cc/table_desc.h - Map metadata storage
src/cc/table_storage.h - Perf event handling
src/python/bcc/perf.py
Instrumentation and data
- Probe and map runtime
src/cc/libbpf.h - Tracing helpers
libbpf-tools/trace_helpers.h - Lock statistics tool
libbpf-tools/klockstat.c - Perf event data
src/cc/perf_reader.c - Kernel BPF maps
src/python/bcc/table.py
Other components
- Operator
- Linux kernel
Connections 34
- Operator → Tracing tools: invokes
README.md - Operator → Argument analysis: invokes
README.md - Operator → System tool families: invokes
README.md - Operator → libbpf tools: invokes
- Tracing tools → Python BPF API: uses
tools/trace.py - Argument analysis → Python BPF API: imports
tools/argdist.py - System tool families → Python BPF API: uses
tools/trace.py - Python BPF API → Native bindings: imports
src/python/bcc/__init__.py - Python BPF API → Python map access: imports
src/python/bcc/__init__.py - Python BPF API → Perf event handling: imports
src/python/bcc/__init__.py - Python BPF API → USDT interface: imports
src/python/bcc/__init__.py - Python BPF API → Disassembler: imports
src/python/bcc/__init__.py - Python BPF API → Python utilities: imports
src/python/bcc/__init__.py - Python BPF API → Compiler and loader: loads through
- Lua frontend → Compiler and loader: uses
- Native bindings → Probe and map runtime: binds
src/cc/libbpf.h - Python map access → Native bindings: calls
src/python/bcc/table.py - Python map access → Kernel BPF maps: accesses
src/python/bcc/table.py - Perf event handling → Perf event data: uses
- USDT interface → Native bindings: calls
src/python/bcc/usdt.py - Python utilities → Native bindings: calls
src/python/bcc/utils.py - Python utilities → Syscall helpers: supports
- BPF module runtime → Exception types: includes
src/cc/bpf_module.h - BPF module runtime → Map metadata storage: uses
src/cc/bpf_module.h - Map metadata storage → Map descriptions: uses
src/cc/table_storage.h - Read-write engine → BPF module runtime: implements
src/cc/bpf_module_rw_engine.cc - Read-write engine → Map metadata storage: uses
src/cc/bpf_module_rw_engine.cc - Compiler and loader → BPF module runtime: loads
- Probe and map runtime → Linux kernel: attaches probes
- Linux kernel → Kernel BPF maps: updates
- Linux kernel → Perf event data: emits events
- libbpf tools → Lock statistics tool: includes
libbpf-tools/klockstat.c - Lock statistics tool → Tracing helpers: uses
libbpf-tools/klockstat.c - Lock statistics tool → Linux kernel: traces locks