内核版本不够时部分功能不可用,5.15 等旧内核需用 make old 构建受限版;编译前要装 libbpf-dev、clang、llvm 等系统包并初始化 git submodule;运行 xcapture 需 root 权限,xtop 还需另装 duckdb 和 textual 并设置 XCAPTURE_DATADIR。

0xtools
tanelpoderGPL-2.0更新放缓一套 Linux 系统性能排查工具集,能像 X 光一样透视进程、CPU 和 I/O 的真实运行状态,快速定位卡顿和异常热点。
0x.Tools: X-Ray vision for Linux systems
git clone https://github.com/tanelpoder/0xtools.git
cd 0xtools
git submodule update --init --recursive
cd xcapture
make
sudo build/xcapture需要 Linux 内核 5.11 以上(依赖 eBPF task storage);RHEL9 5.14+、Oracle UEK7 5.15 或 Ubuntu 20+ 配 HWE 内核;旧内核可用 make old 构建受限版本。README 未提及 GPU 或显存要求。
基于现代 eBPF 的 Linux 线程级性能采样工具,把系统活动写成 CSV 供任意分析
一套 Linux 系统性能排查工具集,能像 X 光一样透视进程、CPU 和 I/O 的真实运行状态,快速定位卡顿和异常热点。
核心能力
- 用 eBPF task iterator 每秒采样全系统线程状态
- 内核态自动跟踪 syscall 与 IO 事件
- 按小时追加写入 CSV 文件,形成可查询的数据仓库
- 输出 CSV 可由非 root 普通用户读取分析
- 自带 xtop 终端 UI 做维度化性能分析
容易踩的坑
- v3.0.3xcapture v3 and xtop first release最新正式版2025-10-23 · 2025-10-23 17:50 UTC
What's Changed
The first proper release of
xcaptureeBPF thread level activity tracker + sampler and a reference implementationxtoptool, showing how to use this data for dimensional performance analysis.The
xcapturebinary uses modern eBPF, therefore it can be compiled once, into a single executable binary and copied to any other server with a sufficiently high GLIBC and kernel version (5.11+). Both x86_64 and aarch64 should work.If you love downloading and running binaries from random GitHub accounts, you can download the
xcapture(orxcapture-oldkernel) binary directly from this release:wget https://github.com/tanelpoder/0xtools/releases/download/v3.0.3/xcapture chmod u+x ./xcapture sudo ./xcaptureSince this is a first and major release, lots of things have changed, I will cover the functionality and details in future blog posts.
New Contributors
- @rebhi made their first contribution in https://github.com/tanelpoder/0xtools/pull/47
- @grcevski made their first contribution in https://github.com/tanelpoder/0xtools/pull/54
- @Christoph-Lutz made their first contribution in https://github.com/tanelpoder/0xtools/pull/53
- @sjuxax made their first contribution in https://github.com/tanelpoder/0xtools/pull/57
Full Changelog: https://github.com/tanelpoder/0xtools/compare/v2.0.3...v3.0.3
- v3.0.0-beta10xtools v3.0.0-beta12025-09-10 · 2025-09-10 00:34 UTC
查看更新说明
New functionality
- xcapture now reads some data from userspace memory, can can sample userspace stack traces
- xtop text UI latency histograms, heatmaps, stack trace reporting, libaio/io_uring SQ/CQ size etc
- new tool: xstack for passive sampling of user/kernel stacks without injecting tracpoints or probes
- the beta version requires RHEL 5.14+ kernel or otherwise 5.18+ kernel (will backport some functionality)
What's Changed
- Fix sqlexecmany function by @rebhi in https://github.com/tanelpoder/0xtools/pull/47
- Fix uninitialized vars and sys call crash by @grcevski in https://github.com/tanelpoder/0xtools/pull/54
- Fix: task_struct backwards-compatibility with kernel versions < 5.14 by @Christoph-Lutz in https://github.com/tanelpoder/0xtools/pull/53
- Fix: task_struct backwards-compatibility with kernel versions < 5.14 (2) by @Christoph-Lutz in https://github.com/tanelpoder/0xtools/pull/55
- Use a /tmp file instead of RAM if duration exceeds 60 seconds by @rebhi in https://github.com/tanelpoder/0xtools/pull/49
- Fix signed div/mod compile error. by @sjuxax in https://github.com/tanelpoder/0xtools/pull/57
New Contributors
- @rebhi made their first contribution in https://github.com/tanelpoder/0xtools/pull/47
- @grcevski made their first contribution in https://github.com/tanelpoder/0xtools/pull/54
- @Christoph-Lutz made their first contribution in https://github.com/tanelpoder/0xtools/pull/53
- @sjuxax made their first contribution in https://github.com/tanelpoder/0xtools/pull/57
Full Changelog: https://github.com/tanelpoder/0xtools/compare/v2.0.3...v3.0.0-beta1
- v2.0.3v2.0.3-beta2024-07-12 · 2024-07-12 21:43 UTC
查看更新说明
This is still a beta / tech-nerd preview release. Please don't run it in busy production environments yet.
The main noteworthy change is that now there's a
-ooption to switch xcapture-bpf to always-on CSV output mode../xcapture-bpf -o /some/dirnameThis will make xcapture log the 1HZ samples into hourly
threads_*files in the output directory and if the stack capture is enabled (its enabled by default in -o mode), it will write any newly seen stack traces into astacks_*file.Unlike the hourly files with 1HZ thread sample history, a single stack file is created at xcapture startup (with a startup timestamp in it) and it appends newly seen, not yet written stacks into the end of the single file.
This is likely the final release of the BCC-based beta / developer preview. I've hit too many limitations sooner than I had thought and will now focus on writing a proper final version of this tool (that I can be proud of!) using libbpf and a better frontend. Use the current v2 release for testing and exploring what's possible!
Full Changelog: https://github.com/tanelpoder/0xtools/compare/v2.0.2...v2.0.3
- v2.0.2v2.0.2-beta2024-07-04 · 2024-07-04 02:31 UTC
查看更新说明
First major release of the next xcapture-bpf beta tool. Updates and fixes for the classic 0x.tools, psn, xcapture (/proc).
What's Changed
Lots!
New Contributors
- @skoehler-soocs made their first contribution in https://github.com/tanelpoder/0xtools/pull/39
Full Changelog: https://github.com/tanelpoder/0xtools/compare/v1.2.4...v2.0.2
- v1.2.4v1.2.4 bugfixes2023-05-25 · 2023-05-25 19:53 UTC
查看更新说明
Fixed a bug where wrong system call names were shown on some versions/platforms (due to looking up wrong unistd.h file)
Full Changelog: https://github.com/tanelpoder/0xtools/compare/v1.2.3...v1.2.4
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
xCapture v3.0.3
By Tanel Poder 2025-10-23
This is the first ever release of 0x.tools xCapture tool that is built with modern eBPF! My previous tools and prototypes were using either bcc, bpftrace or were just sampling and aggregating thread level info from /proc files.
- Announcing xCapture v3: Linux Performance Analysis with Modern eBPF and DuckDB
- xtop: Dimensional Performance Analysis of Sampled Thread Activity

Requirements
Modern eBPF means libbpf, CORE, BTF, BPF iterators, etc. I'll write about my learning journey with proper thank you notes soon.
In practice this means you'll need to be on a Linux kernel 5.11 or up (eBPF task storage). xCapture v3 is a future-facing tool, so I'll invest the time in that direction and not worry about all the legacy systems out there (unlike my approach was with all my previous tools was).
This means, RHEL9+ on Linux 5.14, or Oracle Enterprise Linux 8+, as long as you run at least their UEK7 Linux kernel (5.15). Ubuntu has pretty new kernels (and they have the HWE versions), so Ubuntu 20+ with the latest HWE kernel available for it should work. I have done my latest tests on Ubuntu 24.04 on Linux 6.8 though (will keep you updated once I test more).
Currently you'd have to be either on a RHEL9 5.14+ kernel or 5.18+ otherwise (for all functionality). RedHat backported 6.8 eBPF functionality to their 5.14 kernel (RHEL 9.5 onwards). For older kernels without such backports, notably 5.15 used by Oracle UEK7 kernel and older Ubuntu, use "make old" to build the limited xcapture version.
Building xcapture v3
git clone https://github.com/tanelpoder/0xtools.git
cd 0xtools
Install required system packages for compiling the binary:
On Ubuntu 20.04+ with HWE kernel 5.15+:
sudo apt install make cmake gcc pkg-config libbpf-dev libbpf-tools clang llvm libbfd-dev libelf1 libelf-dev zlib1g-dev
On RHEL9 with RHEL 5.14+ kernel (with RedHat backports):
sudo dnf install libbpf libbpf-tools cmake clang llvm-devel binutils-devel elfutils-libelf elfutils-libelf-devel zlib-devel
To install required libbpf dependencies for the GitHub repo, run:
git submodule update --init --recursive
Running xcapture in developer mode
By default, xcapture prints some of its fields as formatted output to your terminal screen:
cd xcapture
make
sudo build/xcapture
The "always-on" production mode for appending samples to hourly CSV files is enabled by the -o DIRNAME option. You can use -o . to output to your current directory.
While XCapture requires root privileges to load its eBPF programs and do its sampling, the consumers of the output CSV files do not have to be root! They can be any regular user who has the Unix filesystem permissions to read the output directory and CSV files. This provides a nice separation of duties. And you can analyze the "dimensional data warehouse" of Linux thread activity from any angle you want, without having to update or change XCapture itself.
You can also run xcapture --help to get some idea of its current functionality.
NB! While all the syscall & IO tracking action happens automatically in the kernel space, the simulatneous sampling of the tracked events is driven by the userspace xcapture program. The thread state sampling loop actually runs completely inside the kernel too, thanks to eBPF task iterators, but the invocation and frequency of the sampling is driven by the userspace program.
Therefore it makes sense to schedule the userspace "sampling driver" with a high scheduling priority, to get consistently reoccurring samples from it. I run it like this and recommend that you do too:
cd build
sudo TZ=:/etc/localtime chrt -r 30 xcapture -vo DIRNAME
The chrt puts the userspace xcapture program into real-time scheduling class. It's a single, single-threaded process and you'll only need to run only one in the host and it can monitor all threads in the system. By default it wakes up once per second and tells the eBPF task iterator to do its sampling, gets results via an eBPF ringbuf and writes the records either to STDOUT or CSV files.
The entire sampling loop itself is very quick, from ~100us in my laptop VMs, to ~20ms per wakeup in a large NUMA machine with 384 CPUs. So, XCapture passive sampling at 1Hz without active tracking of event latencies has only taken between 0.01% and 2% of a single CPU in my servers! (The 2% of-a-single-CPU result is from my AMD EPYC server with 384 CPUs :-)
The TZ:=/etc/localtime setting gives you two things:
- You can choose your own human wall-clock timezone in which to print out various timestamps. You can set
TZ=(to empty value) to get times in UTC. The kernel and eBPF programs don't deal with human time internally, the CLOCK_MONOTONIC clock-source I'm using is just stored as number of nanoseconds from some arbitrary point in the past. - The timezone environment variable also reduces
xcaptureuserspace CPU usage, as otherwise it would go and check some/etc/localtimezonefile or something like that on everysnprintf()library call.
xtop and demo workload files
If you want to run xtop, install python dependencies to your personal virtual environment (or use uv or pipx):
. .venv/bin/activate # change to where your venv is
pip install duckdb textual
cd xtop
export TERM=xterm-256color
export XCAPTURE_DATADIR=demo # demo workload files under xtop/demo
./xtop
That's all!
Follow the news and developments at my blog tanelpoder.com