namhyung/uftrace
FreeFunction graph tracer for C/C++/Rust/Python
About namhyung/uftrace
uftrace is a function call graph tracer for C, C++, Rust, and Python programs that hooks into function entry and exit points to record timestamps, arguments, and return values. It supports tracing both user and kernel functions, library functions, system events, and provides an integrated execution flow. uftrace can trace without recompilation by dynamically patching function prologues, or via compiler instrumentation (-pg, -finstrument-functions, -fpatchable-function-entry). It offers filters to reduce trace data and provides visualization via Chrome trace viewer, flame graphs, graphviz, and mermaid. Users can write custom scripts using Python or LuaJIT APIs. The tool is heavily inspired by Linux kernel's ftrace and its name combines 'user' and 'ftrace'.
Key Features
Pros & Cons
- Supports multiple languages (C, C++, Rust, Python) and kernel tracing
- Can trace without recompilation using dynamic patching
- Rich visualization output (Chrome trace, flame graph, graphviz, mermaid)
- Scriptable with Python and LuaJIT for custom analysis
- Open source and free to use
- Kernel tracing feature is limited to Linux systems
- Learning curve for advanced features like scripting and dynamic patching
- Requires specific compiler flags or runtime support for full functionality