Unveiling 0x.tools
0x.tools is a suite of open-source utilities by Tanel Poder, designed to provide deep insights into how applications behave under Linux. The key goals are:
- Low friction: minimal dependencies, no kernel modules, no heavy monitoring infrastructure.
- Thread-level visibility: ability to see what each thread is doing — whether it is running, sleeping, waiting on I/O, in kernel, etc.
- Always on, or close to it: tools for continuous sampling to catch intermittent or rare issues.
By combining sampling of /proc
(for legacy and wide support) and newer eBPF-based functionality, 0x.tools bridges the gap between “traditional Linux tools” (top, ps, etc.) and more advanced observability setups.
Key Components & Tools
🔹 xcapture (v1, v2, v3-alpha)
The heart of 0x.tools. It continuously samples threads, capturing their state (running, waiting, sleeping), the current syscall, wait channels, and even stack traces. By storing this data in hourly CSVs, you can “rewind time” during troubleshooting. Perfect for diagnosing elusive issues like lock contention or I/O stalls.
🔹 xtop
Think of it as a “supercharged top.” xtop gives a live, interactive view of processes and threads, but with more detail than top
or htop
. It shows wall-clock times, kernel events, and individual thread behavior — ideal when you need a real-time snapshot with depth.
🔹 psn (Process Snapper)
A lightweight way to capture what threads are doing right now. It reveals which syscalls are active, what wait channels they’re in, and which threads are blocked. Useful for identifying immediate blockers in your system.
🔹 schedlat
This tool zooms in on scheduling latency — how long threads spend waiting before the CPU picks them up. It’s invaluable for spotting CPU starvation, scheduling bottlenecks, and workload imbalances.
🔹 Supporting Utilities
Other tools like lsds
, syscallargs
, tracepointargs
, and xstack
add detail about block devices, syscall arguments, kernel tracepoints, and stack behavior. Together, they extend your visibility from surface symptoms into root causes.
Why It Matters — Use Cases & Trade-Offs
Use Cases
- Production issue investigation: When something bad happens occasionally (latency spike, system pause, IO stall), classic monitoring (CPU, memory, I/O metrics) might not show why. 0x.tools lets you sample what threads were doing at those moments.
- Kernel vs Application boundary issues: Sometimes the delay is inside the kernel — e.g. lock contention, fsync, block device waits. 0x.tools highlights those.
- Legacy or constrained environments: Environments where you can’t install kernel modules or change kernel version easily. Since many components use
/proc
sampling, it supports older systems. - Continuous profiling strategy: By collecting lightweight samples over time, you build a historical view. When trouble hits, you can inspect preceding behavior.
Trade-Offs & Considerations
- Overhead is low but non-zero. Sampling, even every second, uses some CPU. But designed to be <1%.
- On systems with tens of thousands of active threads, even sampling /proc can become expensive; you might need to reduce sample frequency.
- While eBPF adds more power and richer detail, it may not be available or supported on all Linux kernels or in all operating environments (enterprises, older machines).
- The tooling is strong for diagnosing what is happening, but less about visualization / dashboards (though that is in the roadmap). Requires comfort with command line, parsing CSVs, etc.
How It Works — Architecture & Methods
- Proc-based sampling: Many tools in 0x.tools simply read from
/proc
(which Linux exposes many kernel statistics via virtual files) at intervals. Thread state, syscalls, wait channels, etc. - eBPF: Where supported, newer components (xcapture v3-alpha, etc.) leverage eBPF for more precise event instrumentation with less overhead. Enables off-CPU sampling, hooking into kernel tracepoints, etc.
- Historical archival: Samples can be written to hourly CSV archives, enabling “look back” after an issue. You can use standard text processing tools (awk, grep, etc.) or load into databases.
Practical Advice for Using 0x.tools Well
- Start small in production
Try sampling every few seconds or longer, maybe only on some hosts, to get a feel for overhead. - Correlate with external metrics
Use 0x.tools in conjunction with your usual monitoring stack (CPU, mem, IO, latency). When dashboards show anomalies, check 0x.tools archives to see thread behavior. - Use historical data
The ability to capture continuous or regular samplings means you might capture the root cause even before you realize there’s an issue. - Know your kernel/environment limitations
If eBPF not available, stick to proc-based tools. Some kernel versions limit certain tracepoints. - Automate retention / cleanup
CSV archives can grow; set up scripts to compress, rotate, archive or drop old data.
Why 0x.tools Fills an Important Niche
In many Linux performance stacks, there are gaps:
- Tools like prometheus, Grafana, CloudWatch etc. help aggregate metrics, show system usage over time. But they often don’t expose why a thread is waiting, or which syscall is slow.
- Distributed tracing (Jaeger, Zipkin) shows request flows, but not the low-level wait, lock, or kernel layer behavior inside threads.
- Traditional tools (top, ps) are great, but either only see CPU usage or don’t show sleeping/waiting in detail, or require manual invocation.
0x.tools sits in that gap: providing thread-level, kernel-aware, low overhead visibility, both live and historical.
Conclusion
0x.tools is an exciting toolset for anyone who manages Linux servers and cares about performance on a deeper level. It offers:
- visibility into what threads are waiting on, sleeping, or doing, rather than just coarse CPU / memory usage,
- the ability to catch intermittent or rare performance degradation,
- application in environments where heavier instrumentation is difficult or not allowed.
For system administrators, site reliability engineers, performance engineers: 0x.tools can reduce the time to identify root causes by clarifying what is really going on inside your system when things seem “slow” but no obvious metrics are showing a problem.