0xtools

tanelpoderGPL-2.0更新放缓

一套 Linux 系统性能排查工具集,能像 X 光一样透视进程、CPU 和 I/O 的真实运行状态,快速定位卡顿和异常热点。

0x.Tools: X-Ray vision for Linux systems

v3.0.3发布于 2025-10-23 17:50 UTC1,825star134fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/tanelpoder/0xtools.git
cd 0xtools
git submodule update --init --recursive
cd xcapture
make
sudo build/xcapture
硬件要求按 README 说明

需要 Linux 内核 5.11 以上(依赖 eBPF task storage);RHEL9 5.14+、Oracle UEK7 5.15 或 Ubuntu 20+ 配 HWE 内核;旧内核可用 make old 构建受限版本。README 未提及 GPU 或显存要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于现代 eBPF 的 Linux 线程级性能采样工具,把系统活动写成 CSV 供任意分析

一套 Linux 系统性能排查工具集,能像 X 光一样透视进程、CPU 和 I/O 的真实运行状态,快速定位卡顿和异常热点。

核心能力

  • 用 eBPF task iterator 每秒采样全系统线程状态
  • 内核态自动跟踪 syscall 与 IO 事件
  • 按小时追加写入 CSV 文件,形成可查询的数据仓库
  • 输出 CSV 可由非 root 普通用户读取分析
  • 自带 xtop 终端 UI 做维度化性能分析

容易踩的坑

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

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v3.0.3
  1. 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 xcapture eBPF thread level activity tracker + sampler and a reference implementation xtop tool, showing how to use this data for dimensional performance analysis.

    The xcapture binary 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 (or xcapture-oldkernel) binary directly from this release:

    wget https://github.com/tanelpoder/0xtools/releases/download/v3.0.3/xcapture
    chmod u+x ./xcapture
    sudo ./xcapture
    

    Since 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

    Full Changelog: https://github.com/tanelpoder/0xtools/compare/v2.0.3...v3.0.3

  2. 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

    New Contributors

    Full Changelog: https://github.com/tanelpoder/0xtools/compare/v2.0.3...v3.0.0-beta1

  3. 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 -o option to switch xcapture-bpf to always-on CSV output mode.

    ./xcapture-bpf -o /some/dirname

    This 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 a stacks_* 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

  4. 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

    Full Changelog: https://github.com/tanelpoder/0xtools/compare/v1.2.4...v2.0.2

  5. 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

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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.

    xtop terminal ui

    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:

    1. 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.
    2. The timezone environment variable also reduces xcapture userspace CPU usage, as otherwise it would go and check some /etc/localtimezone file or something like that on every snprintf() 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