How tanelpoder/0xtools works
xCapture captures Linux thread activity through eBPF sampling and optional syscall/I/O tracking, then emits terminal output or CSV datasets. xtop consumes those datasets for DuckDB-backed dimensional queries and interactive terminal analysis, including latency histograms, heatmaps, and cell details. The graph preserves these distinct capture and analysis stages. Several probe and TUI implementations are unsampled, so their roles are represented from documented capabilities and the tree, with unverified links marked dashed.
Main entry points: main.c Sampling driver · cell_peek_modal.py Cell detail views · query_engine.py Query engine · task_handler.c Sample handling
Components 21
xCapture capture
- Sampling driver
xcapture/src/user/main.c - Task sampler
xcapture/src/probes/task/task.bpf.c - Syscall tracking
xcapture/src/probes/syscall/syscall.bpf.c - I/O tracking
xcapture/src/probes/io/iorq_hashmap.bpf.c - Sample handling
xcapture/src/user/task_handler.c - Tracking handling
xcapture/src/user/tracking_handler.c - CSV output
xcapture/src/user/output_writer.c - Terminal output
xcapture/src/user/columns.c
xtop analysis
- CSV data source
xtop/core/data_source.py - Query engine
xtop/core/query_engine.py - SQL query builder
xtop/core/query_builder.py - Time filtering
xtop/core/csv_time_filter.py - Heatmap analysis
xtop/core/heatmap.py - Time utilities
xtop/core/time_utils.py
Interactive presentation
- xtop terminal UI
xtop/tui/cell_peek_modal.py - Cell detail views
xtop/tui/cell_peek_modal.py - Heatmap rendering
xtop/core/heatmap_visualizer.py - Histogram formatting
xtop/core/histogram_formatter.py
Other components
- Operator
- Capture datasets
- DuckDB
Connections 23
- Operator → Sampling driver: starts
- Sampling driver → Task sampler: drives sampling
- Syscall tracking → Tracking handling: emits events
- I/O tracking → Tracking handling: emits events
- Task sampler → Sample handling: emits samples
- Sampling driver → Sample handling: handles samples
- Sampling driver → Tracking handling: handles tracking
- Sample handling → CSV output: writes records
- Tracking handling → CSV output: writes records
xcapture/src/user/tracking_handler.c - Sample handling → Terminal output: formats output
xcapture/src/user/task_handler.c - Sampling driver → Terminal output: prints results
- CSV output → Capture datasets: appends samples
- Capture datasets → CSV data source: reads CSV
- CSV data source → Time filtering: uses time filter
xtop/core/data_source.py - Query engine → CSV data source: connects to
xtop/core/query_engine.py - Query engine → SQL query builder: builds queries
xtop/core/query_engine.py - Query engine → DuckDB: executes SQL
xtop/core/query_engine.py - Operator → xtop terminal UI: analyzes data
- xtop terminal UI → Query engine: queries data
- Cell detail views → Heatmap analysis: uses analysis
xtop/tui/cell_peek_modal.py - Cell detail views → Heatmap rendering: renders heatmap
xtop/tui/cell_peek_modal.py - Cell detail views → Histogram formatting: formats histogram
xtop/tui/cell_peek_modal.py - Cell detail views → Time utilities: uses time helpers
xtop/tui/cell_peek_modal.py