9 releases (breaking)
| 0.10.0 | Sep 1, 2025 |
|---|---|
| 0.9.0 | Aug 17, 2025 |
| 0.8.0 | Aug 15, 2025 |
| 0.7.0 | Aug 15, 2025 |
| 0.1.0 | Mar 2, 2025 |
#627 in Debugging
548 downloads per month
Used in rstrace
15KB
216 lines
rstrace
rstrace is a Rust implementation of strace for x86 Linux. It allows the user to trace system calls of a process or command.
Unlike strace it can introspect NVIDIA CUDA system calls.
Install
[!NOTE] Currently only x86 Linux is supported. aarch64 support is planned, but MacOS support is out-of-scope.
Binary download
curl -LsSf https://rstrace.xyz/install.sh | sh
Cargo
cargo install rstrace
Usage
rstrace ls /tmp/
To get a quick overview, use rstrace --help
Usage: rstrace [OPTIONS] [ARGS]...
Arguments:
[ARGS]... Arguments for the program to trace. e.g. 'ls /tmp/'
Options:
-o, --output <OUTPUT> send trace output to FILE instead of stderr
-t, --timestamp... Print absolute timestamp. -tt includes microseconds, -ttt uses UNIX timestamps
-c, --summary-only Count time, calls, and errors for each syscall and report summary
-C, --summary like -c, but also print the regular output
-j, --summary-json Count time, calls, and errors for each syscall and report summary in JSON format
--tef Emit Trace Event Format (TEF) trace data as output
--verbose Output human readable information about CUDA ioctls.
--cuda Enable CUDA ioctl sniffing. [Requires 'cuda_sniff' feature]
--cuda-only Enable CUDA ioctl sniffing and disable all other output. [Requires 'cuda_sniff' feature]
-p, --attach <PID> Attach to the process with the process ID pid and begin tracing.
-f, --follow-forks Trace child processes as they are created by currently traced processes as a result of the fork(2), vfork(2) and clone(2) system calls.
--color Enable colored output (default)
-h, --help Print help
-V, --version Print version
cuda_sniff extension
cuda_sniff is an extension to strace-rs that allows the user to trace CUDA API calls. It is based on
https://github.com/geohot/cuda_ioctl_sniffer by George Hotz.
gvisor has an alternative implementation called ioct_sniffer which uses LD_PRELOAD to intercept calls,
unlike strace-rs which uses ptrace.
Alternatives
-
https://github.com/bpftrace/bpftrace
- Don't use rstrace/strace in production. Where feasible use
bpftracewhich is a more powerful tracing tool with much lower overhead.
- Don't use rstrace/strace in production. Where feasible use
Dependencies
~0–2MB
~40K SLoC