The Fuchsia tracing system allows you to collect and visualize diagnostic information from Fuchsia components.
Fuchsia's tracing system offers a comprehensive way to collect, aggregate, and visualize diagnostic tracing information from the Fuchsia user space processes and the Zircon kernel. Traces, like logs, represent events from a Fuchsia system, but are fine grained, higher frequency and are meant for machine consumption to compute other insights and visualizations.
Tracing and profiling are a powerful pair of tools to gain insights into the performance of a system. In comparison to profiling which samples data every so often, tracing captures every event in a short duration and can include extra information with the trace event.
Generally,profiling is more useful if you don't know where the problem is, and aren't sure where to put trace spans, or you aren't able to add tracing events.
Tracing involves three high-level steps:
- Instrument: Instrument your code so that you can measure the runtime of specific functions by surrounding these pieces of code with trace events and add labels to emit during a trace.
- Record: Configure and start a tracing tool (
ffx trace
) to generate a trace. - Analyze: Visualize the report with a UI such as Perfetto to identify issues and potential ways to optimize your code.
General
- Use trace events: This document explains the various types of tracing events that Fuchsia supports and how to use them in your components.
Fuchsia recommends that you use the Perfetto UI to view the traces that you collect from Fuchsia components. For more information on using Perfetto, see the Perfetto documentation.
Tutorial
If you're new to tracing, see Tutorial on Fuchsia tracing.
This tutorial provides a high level overview of tracing and the steps necessary to add tracing to your Fuchsia components.
Advanced guides
These guides are for advanced users who already understand the basics of tracing in Fuchsia: