itrace is a processor level runtime tracing tool built around the Intel
Processor Trace technology.
Record a trace with itrace record and convert it to Fuchsia format with
itrace export.

Export to Perfetto to view a flamegraph of the
trace in your browser. Select your portion of interest and copy the time range.

Decode the trace with itrace decode. Select a timerange of interest from the
Perfetto flamegraph.

sudo apt update
sudo apt install linux-tools-generic
sudo apt install cmake
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
./setup.py
sudo ./setup.py --install
Optionally, if you want to export and view the traces on Perfetto, you can build with the exporter. The exporter requires Rust and Cargo which can be installed here.
sudo apt install llvm clang libclang-dev
./setup.py --export
sudo ./setup.py --install
itrace relies heavily on other projects for its functionality. Thank you to these projects!
perfhandles all of the interfacing with Intel Processor Trace.itraceis really just a nice wrapper aroundperf.xedis used for decoding x86 instructionsperf2perfettois used for exportperf's trace format to Fuchsia trace format for viewing on Perfetto